<!DOCTYPE html>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" />
<title>libtorrent</title>
<meta name="description" content="A feature complete BitTorrent protocol implementation as a C++ library">
<meta name=viewport content="width=device-width, initial-scale=1">
<meta property="og:image" content="img/logo-color.png" />
<meta property="og:site_name" content="libtorrent" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="document">
    <div id="container">
    <a href="index.html">
    <img src="img/logo-color-text.png" alt="libtorrent logo"/>
    </a>
    <div>

<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Version:</th>
<td>2.0.11</td></tr>
</tbody>
</table>
<p><a class="reference external" href="reference.html">home</a></p>
<div class="contents topic" id="table-of-contents">
<p class="topic-title">Table of contents</p>
<ul class="simple">
<li><a class="reference internal" href="#dht-routing-bucket" id="toc-entry-1">dht_routing_bucket</a></li>
<li><a class="reference internal" href="#torrent-alert" id="toc-entry-2">torrent_alert</a><ul>
<li><a class="reference internal" href="#message" id="toc-entry-3">message()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#peer-alert" id="toc-entry-4">peer_alert</a></li>
<li><a class="reference internal" href="#tracker-alert" id="toc-entry-5">tracker_alert</a><ul>
<li><a class="reference internal" href="#tracker-url" id="toc-entry-6">tracker_url()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#torrent-removed-alert" id="toc-entry-7">torrent_removed_alert</a></li>
<li><a class="reference internal" href="#read-piece-alert" id="toc-entry-8">read_piece_alert</a></li>
<li><a class="reference internal" href="#file-completed-alert" id="toc-entry-9">file_completed_alert</a></li>
<li><a class="reference internal" href="#file-renamed-alert" id="toc-entry-10">file_renamed_alert</a><ul>
<li><a class="reference internal" href="#new-name-old-name" id="toc-entry-11">new_name() old_name()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#file-rename-failed-alert" id="toc-entry-12">file_rename_failed_alert</a></li>
<li><a class="reference internal" href="#performance-alert" id="toc-entry-13">performance_alert</a><ul>
<li><a class="reference internal" href="#enum-performance-warning-t" id="toc-entry-14">enum performance_warning_t</a></li>
</ul>
</li>
<li><a class="reference internal" href="#state-changed-alert" id="toc-entry-15">state_changed_alert</a></li>
<li><a class="reference internal" href="#tracker-error-alert" id="toc-entry-16">tracker_error_alert</a><ul>
<li><a class="reference internal" href="#failure-reason" id="toc-entry-17">failure_reason()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#tracker-warning-alert" id="toc-entry-18">tracker_warning_alert</a><ul>
<li><a class="reference internal" href="#warning-message" id="toc-entry-19">warning_message()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#scrape-reply-alert" id="toc-entry-20">scrape_reply_alert</a></li>
<li><a class="reference internal" href="#scrape-failed-alert" id="toc-entry-21">scrape_failed_alert</a><ul>
<li><a class="reference internal" href="#error-message" id="toc-entry-22">error_message()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#tracker-reply-alert" id="toc-entry-23">tracker_reply_alert</a></li>
<li><a class="reference internal" href="#dht-reply-alert" id="toc-entry-24">dht_reply_alert</a></li>
<li><a class="reference internal" href="#tracker-announce-alert" id="toc-entry-25">tracker_announce_alert</a></li>
<li><a class="reference internal" href="#hash-failed-alert" id="toc-entry-26">hash_failed_alert</a></li>
<li><a class="reference internal" href="#peer-ban-alert" id="toc-entry-27">peer_ban_alert</a></li>
<li><a class="reference internal" href="#peer-unsnubbed-alert" id="toc-entry-28">peer_unsnubbed_alert</a></li>
<li><a class="reference internal" href="#peer-snubbed-alert" id="toc-entry-29">peer_snubbed_alert</a></li>
<li><a class="reference internal" href="#peer-error-alert" id="toc-entry-30">peer_error_alert</a></li>
<li><a class="reference internal" href="#peer-connect-alert" id="toc-entry-31">peer_connect_alert</a><ul>
<li><a class="reference internal" href="#enum-direction-t" id="toc-entry-32">enum direction_t</a></li>
</ul>
</li>
<li><a class="reference internal" href="#peer-disconnected-alert" id="toc-entry-33">peer_disconnected_alert</a></li>
<li><a class="reference internal" href="#invalid-request-alert" id="toc-entry-34">invalid_request_alert</a></li>
<li><a class="reference internal" href="#torrent-finished-alert" id="toc-entry-35">torrent_finished_alert</a></li>
<li><a class="reference internal" href="#piece-finished-alert" id="toc-entry-36">piece_finished_alert</a></li>
<li><a class="reference internal" href="#request-dropped-alert" id="toc-entry-37">request_dropped_alert</a></li>
<li><a class="reference internal" href="#block-timeout-alert" id="toc-entry-38">block_timeout_alert</a></li>
<li><a class="reference internal" href="#block-finished-alert" id="toc-entry-39">block_finished_alert</a></li>
<li><a class="reference internal" href="#block-downloading-alert" id="toc-entry-40">block_downloading_alert</a></li>
<li><a class="reference internal" href="#unwanted-block-alert" id="toc-entry-41">unwanted_block_alert</a></li>
<li><a class="reference internal" href="#storage-moved-alert" id="toc-entry-42">storage_moved_alert</a><ul>
<li><a class="reference internal" href="#storage-path-old-path" id="toc-entry-43">storage_path() old_path()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#storage-moved-failed-alert" id="toc-entry-44">storage_moved_failed_alert</a><ul>
<li><a class="reference internal" href="#file-path" id="toc-entry-45">file_path()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#torrent-deleted-alert" id="toc-entry-46">torrent_deleted_alert</a></li>
<li><a class="reference internal" href="#torrent-delete-failed-alert" id="toc-entry-47">torrent_delete_failed_alert</a></li>
<li><a class="reference internal" href="#save-resume-data-alert" id="toc-entry-48">save_resume_data_alert</a></li>
<li><a class="reference internal" href="#save-resume-data-failed-alert" id="toc-entry-49">save_resume_data_failed_alert</a></li>
<li><a class="reference internal" href="#torrent-paused-alert" id="toc-entry-50">torrent_paused_alert</a></li>
<li><a class="reference internal" href="#torrent-resumed-alert" id="toc-entry-51">torrent_resumed_alert</a></li>
<li><a class="reference internal" href="#torrent-checked-alert" id="toc-entry-52">torrent_checked_alert</a></li>
<li><a class="reference internal" href="#url-seed-alert" id="toc-entry-53">url_seed_alert</a><ul>
<li><a class="reference internal" href="#server-url" id="toc-entry-54">server_url()</a></li>
<li><a class="reference internal" href="#error-message-1" id="toc-entry-55">error_message()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#file-error-alert" id="toc-entry-56">file_error_alert</a><ul>
<li><a class="reference internal" href="#filename" id="toc-entry-57">filename()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#metadata-failed-alert" id="toc-entry-58">metadata_failed_alert</a></li>
<li><a class="reference internal" href="#metadata-received-alert" id="toc-entry-59">metadata_received_alert</a></li>
<li><a class="reference internal" href="#udp-error-alert" id="toc-entry-60">udp_error_alert</a></li>
<li><a class="reference internal" href="#external-ip-alert" id="toc-entry-61">external_ip_alert</a></li>
<li><a class="reference internal" href="#listen-failed-alert" id="toc-entry-62">listen_failed_alert</a><ul>
<li><a class="reference internal" href="#listen-interface" id="toc-entry-63">listen_interface()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#listen-succeeded-alert" id="toc-entry-64">listen_succeeded_alert</a></li>
<li><a class="reference internal" href="#portmap-error-alert" id="toc-entry-65">portmap_error_alert</a></li>
<li><a class="reference internal" href="#portmap-alert" id="toc-entry-66">portmap_alert</a></li>
<li><a class="reference internal" href="#portmap-log-alert" id="toc-entry-67">portmap_log_alert</a><ul>
<li><a class="reference internal" href="#log-message" id="toc-entry-68">log_message()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#fastresume-rejected-alert" id="toc-entry-69">fastresume_rejected_alert</a><ul>
<li><a class="reference internal" href="#file-path-1" id="toc-entry-70">file_path()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#peer-blocked-alert" id="toc-entry-71">peer_blocked_alert</a><ul>
<li><a class="reference internal" href="#enum-reason-t" id="toc-entry-72">enum reason_t</a></li>
</ul>
</li>
<li><a class="reference internal" href="#dht-announce-alert" id="toc-entry-73">dht_announce_alert</a></li>
<li><a class="reference internal" href="#dht-get-peers-alert" id="toc-entry-74">dht_get_peers_alert</a></li>
<li><a class="reference internal" href="#cache-flushed-alert" id="toc-entry-75">cache_flushed_alert</a></li>
<li><a class="reference internal" href="#lsd-peer-alert" id="toc-entry-76">lsd_peer_alert</a></li>
<li><a class="reference internal" href="#trackerid-alert" id="toc-entry-77">trackerid_alert</a><ul>
<li><a class="reference internal" href="#tracker-id" id="toc-entry-78">tracker_id()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#dht-bootstrap-alert" id="toc-entry-79">dht_bootstrap_alert</a></li>
<li><a class="reference internal" href="#torrent-error-alert" id="toc-entry-80">torrent_error_alert</a><ul>
<li><a class="reference internal" href="#filename-1" id="toc-entry-81">filename()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#torrent-need-cert-alert" id="toc-entry-82">torrent_need_cert_alert</a></li>
<li><a class="reference internal" href="#incoming-connection-alert" id="toc-entry-83">incoming_connection_alert</a></li>
<li><a class="reference internal" href="#add-torrent-alert" id="toc-entry-84">add_torrent_alert</a></li>
<li><a class="reference internal" href="#state-update-alert" id="toc-entry-85">state_update_alert</a></li>
<li><a class="reference internal" href="#session-stats-alert" id="toc-entry-86">session_stats_alert</a><ul>
<li><a class="reference internal" href="#counters" id="toc-entry-87">counters()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#dht-error-alert" id="toc-entry-88">dht_error_alert</a></li>
<li><a class="reference internal" href="#dht-immutable-item-alert" id="toc-entry-89">dht_immutable_item_alert</a></li>
<li><a class="reference internal" href="#dht-mutable-item-alert" id="toc-entry-90">dht_mutable_item_alert</a></li>
<li><a class="reference internal" href="#dht-put-alert" id="toc-entry-91">dht_put_alert</a></li>
<li><a class="reference internal" href="#i2p-alert" id="toc-entry-92">i2p_alert</a></li>
<li><a class="reference internal" href="#dht-outgoing-get-peers-alert" id="toc-entry-93">dht_outgoing_get_peers_alert</a></li>
<li><a class="reference internal" href="#log-alert" id="toc-entry-94">log_alert</a><ul>
<li><a class="reference internal" href="#log-message-1" id="toc-entry-95">log_message()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#torrent-log-alert" id="toc-entry-96">torrent_log_alert</a><ul>
<li><a class="reference internal" href="#log-message-2" id="toc-entry-97">log_message()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#peer-log-alert" id="toc-entry-98">peer_log_alert</a><ul>
<li><a class="reference internal" href="#log-message-3" id="toc-entry-99">log_message()</a></li>
<li><a class="reference internal" href="#enum-direction-t-1" id="toc-entry-100">enum direction_t</a></li>
</ul>
</li>
<li><a class="reference internal" href="#lsd-error-alert" id="toc-entry-101">lsd_error_alert</a></li>
<li><a class="reference internal" href="#dht-lookup" id="toc-entry-102">dht_lookup</a></li>
<li><a class="reference internal" href="#dht-stats-alert" id="toc-entry-103">dht_stats_alert</a></li>
<li><a class="reference internal" href="#incoming-request-alert" id="toc-entry-104">incoming_request_alert</a></li>
<li><a class="reference internal" href="#dht-log-alert" id="toc-entry-105">dht_log_alert</a><ul>
<li><a class="reference internal" href="#log-message-4" id="toc-entry-106">log_message()</a></li>
<li><a class="reference internal" href="#enum-dht-module-t" id="toc-entry-107">enum dht_module_t</a></li>
</ul>
</li>
<li><a class="reference internal" href="#dht-pkt-alert" id="toc-entry-108">dht_pkt_alert</a><ul>
<li><a class="reference internal" href="#pkt-buf" id="toc-entry-109">pkt_buf()</a></li>
<li><a class="reference internal" href="#enum-direction-t-2" id="toc-entry-110">enum direction_t</a></li>
</ul>
</li>
<li><a class="reference internal" href="#dht-get-peers-reply-alert" id="toc-entry-111">dht_get_peers_reply_alert</a></li>
<li><a class="reference internal" href="#dht-direct-response-alert" id="toc-entry-112">dht_direct_response_alert</a></li>
<li><a class="reference internal" href="#picker-log-alert" id="toc-entry-113">picker_log_alert</a></li>
<li><a class="reference internal" href="#session-error-alert" id="toc-entry-114">session_error_alert</a></li>
<li><a class="reference internal" href="#dht-live-nodes-alert" id="toc-entry-115">dht_live_nodes_alert</a><ul>
<li><a class="reference internal" href="#num-nodes-nodes" id="toc-entry-116">num_nodes() nodes()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#session-stats-header-alert" id="toc-entry-117">session_stats_header_alert</a></li>
<li><a class="reference internal" href="#dht-sample-infohashes-alert" id="toc-entry-118">dht_sample_infohashes_alert</a><ul>
<li><a class="reference internal" href="#num-samples-samples" id="toc-entry-119">num_samples() samples()</a></li>
<li><a class="reference internal" href="#num-nodes" id="toc-entry-120">num_nodes()</a></li>
<li><a class="reference internal" href="#nodes" id="toc-entry-121">nodes()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#block-uploaded-alert" id="toc-entry-122">block_uploaded_alert</a></li>
<li><a class="reference internal" href="#alerts-dropped-alert" id="toc-entry-123">alerts_dropped_alert</a></li>
<li><a class="reference internal" href="#socks5-alert" id="toc-entry-124">socks5_alert</a></li>
<li><a class="reference internal" href="#file-prio-alert" id="toc-entry-125">file_prio_alert</a></li>
<li><a class="reference internal" href="#oversized-file-alert" id="toc-entry-126">oversized_file_alert</a></li>
<li><a class="reference internal" href="#torrent-conflict-alert" id="toc-entry-127">torrent_conflict_alert</a></li>
<li><a class="reference internal" href="#peer-info-alert" id="toc-entry-128">peer_info_alert</a></li>
<li><a class="reference internal" href="#file-progress-alert" id="toc-entry-129">file_progress_alert</a></li>
<li><a class="reference internal" href="#piece-info-alert" id="toc-entry-130">piece_info_alert</a></li>
<li><a class="reference internal" href="#piece-availability-alert" id="toc-entry-131">piece_availability_alert</a></li>
<li><a class="reference internal" href="#tracker-list-alert" id="toc-entry-132">tracker_list_alert</a></li>
<li><a class="reference internal" href="#alert" id="toc-entry-133">alert</a><ul>
<li><a class="reference internal" href="#timestamp" id="toc-entry-134">timestamp()</a></li>
<li><a class="reference internal" href="#type" id="toc-entry-135">type()</a></li>
<li><a class="reference internal" href="#what" id="toc-entry-136">what()</a></li>
<li><a class="reference internal" href="#message-1" id="toc-entry-137">message()</a></li>
<li><a class="reference internal" href="#category" id="toc-entry-138">category()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#alert-cast" id="toc-entry-139">alert_cast()</a></li>
<li><a class="reference internal" href="#operation-name" id="toc-entry-140">operation_name()</a></li>
<li><a class="reference internal" href="#enum-operation-t" id="toc-entry-141">enum operation_t</a></li>
<li><a class="reference internal" href="#int" id="toc-entry-142">int</a></li>
<li><a class="reference internal" href="#alert-category-t" id="toc-entry-143">alert_category_t</a></li>
</ul>
</div>
<p>The <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> function on <a class="reference external" href="reference-Session.html#session">session</a> is the main interface for retrieving
alerts (warnings, messages and errors from libtorrent). If no alerts have
been posted by libtorrent <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> will return an empty list.</p>
<p>By default, only errors are reported. <a class="reference external" href="reference-Settings.html#alert_mask">settings_pack::alert_mask</a> can be
used to specify which kinds of events should be reported. The <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask is
a combination of the <a class="reference external" href="reference-Alerts.html#alert_category_t">alert_category_t</a> flags in the <a class="reference external" href="reference-Alerts.html#alert">alert</a> class.</p>
<p>Every <a class="reference external" href="reference-Alerts.html#alert">alert</a> belongs to one or more category. There is a cost associated with
posting alerts. Only alerts that belong to an enabled category are
posted. Setting the <a class="reference external" href="reference-Alerts.html#alert">alert</a> bitmask to 0 will disable all alerts (except those
that are non-discardable). Alerts that are responses to API calls such as
<a class="reference external" href="reference-Torrent_Handle.html#save_resume_data()">save_resume_data()</a> and <a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a> are non-discardable and will be
posted even if their category is disabled.</p>
<p>There are other <a class="reference external" href="reference-Alerts.html#alert">alert</a> base classes that some alerts derive from, all the
alerts that are generated for a specific torrent are derived from
<a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a>, and tracker events derive from <a class="reference external" href="reference-Alerts.html#tracker_alert">tracker_alert</a>.</p>
<p>Alerts returned by <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> are only valid until the next call to
<a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a>. You may not copy an <a class="reference external" href="reference-Alerts.html#alert">alert</a> object to access it after the next
call to <a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a>. Internal members of alerts also become invalid once
<a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> is called again.</p>
<a name="dht_routing_bucket"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_routing_bucket&labels=documentation&body=Documentation+under+heading+%22class+dht_routing_bucket%22+could+be+improved">report issue</a>]</span><div class="section" id="dht-routing-bucket">
<h1>dht_routing_bucket</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>struct to hold information about a single DHT routing table bucket</p>
<pre class="literal-block">
struct dht_routing_bucket
{
   int num_nodes;
   int num_replacements;
   int last_active;
};
</pre>
<a name="num_nodes"></a>
<a name="num_replacements"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_routing_bucket%3A%3A%5Bnum_nodes+num_replacements%5D&labels=documentation&body=Documentation+under+heading+%22dht_routing_bucket%3A%3A%5Bnum_nodes+num_replacements%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>num_nodes num_replacements</dt>
<dd>the total number of nodes and replacement nodes
in the routing table</dd>
</dl>
<a name="last_active"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_routing_bucket%3A%3A%5Blast_active%5D&labels=documentation&body=Documentation+under+heading+%22dht_routing_bucket%3A%3A%5Blast_active%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>last_active</dt>
<dd>number of seconds since last activity</dd>
</dl>
<a name="torrent_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="torrent-alert">
<h1>torrent_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This is a base class for alerts that are associated with a
specific torrent. It contains a handle to the torrent.</p>
<p>Note that by the time the client receives a <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a>, its
<tt class="docutils literal">handle</tt> member may be invalid.</p>
<pre class="literal-block">
struct torrent_alert : alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>torrent_name</strong> () const;

   torrent_handle handle;
};
</pre>
<a name="message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_alert%3A%3A%5Bmessage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_alert%3A%3A%5Bmessage%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="message">
<h2>message()</h2>
<pre class="literal-block">
std::string <strong>message</strong> () const override;
</pre>
<p>returns the message associated with this <a class="reference external" href="reference-Alerts.html#alert">alert</a></p>
<a name="handle"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_alert%3A%3A%5Bhandle%5D&labels=documentation&body=Documentation+under+heading+%22torrent_alert%3A%3A%5Bhandle%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>handle</dt>
<dd>The <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> pointing to the torrent this
<a class="reference external" href="reference-Alerts.html#alert">alert</a> is associated with.</dd>
</dl>
<a name="peer_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="peer-alert">
<h1>peer_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>The peer <a class="reference external" href="reference-Alerts.html#alert">alert</a> is a base class for alerts that refer to a specific peer. It includes all
the information to identify the peer. i.e. <tt class="docutils literal">ip</tt> and <tt class="docutils literal"><span class="pre">peer-id</span></tt>.</p>
<pre class="literal-block">
struct peer_alert : torrent_alert
{
   std::string <strong>message</strong> () const override;

   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; endpoint;
   peer_id pid;
};
</pre>
<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22peer_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>endpoint</dt>
<dd>The peer's IP address and port.</dd>
</dl>
<a name="pid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_alert%3A%3A%5Bpid%5D&labels=documentation&body=Documentation+under+heading+%22peer_alert%3A%3A%5Bpid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>pid</dt>
<dd>the peer ID, if known.</dd>
</dl>
<a name="tracker_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="tracker-alert">
<h1>tracker_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This is a base class used for alerts that are associated with a
specific tracker. It derives from <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a> since a tracker
is also associated with a specific torrent.</p>
<pre class="literal-block">
struct tracker_alert : torrent_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>tracker_url</strong> () const;

   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; local_endpoint;
};
</pre>
<a name="tracker_url()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_alert%3A%3A%5Btracker_url%28%29%5D&labels=documentation&body=Documentation+under+heading+%22tracker_alert%3A%3A%5Btracker_url%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="tracker-url">
<h2>tracker_url()</h2>
<pre class="literal-block">
char const* <strong>tracker_url</strong> () const;
</pre>
<p>returns a 0-terminated string of the tracker's URL</p>
<a name="local_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_alert%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22tracker_alert%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>local_endpoint</dt>
<dd>endpoint of the listen interface being announced</dd>
</dl>
<a name="torrent_removed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_removed_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_removed_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="torrent-removed-alert">
<h1>torrent_removed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>The <tt class="docutils literal">torrent_removed_alert</tt> is posted whenever a torrent is removed. Since
the torrent handle in its base class will usually be invalid (since the torrent
is already removed) it has the info hash as a member, to identify it.
It's posted when the <tt class="docutils literal"><span class="pre">alert_category::status</span></tt> bit is set in the alert_mask.</p>
<p>Note that the <tt class="docutils literal">handle</tt> remains valid for some time after
<a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a> is posted, as long as some internal libtorrent
task (such as an I/O task) refers to it. Additionally, other alerts like
<a class="reference external" href="reference-Alerts.html#save_resume_data_alert">save_resume_data_alert</a> may be posted after <a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a>.
To synchronize on whether the torrent has been removed or not, call
<a class="reference external" href="reference-Torrent_Handle.html#in_session()">torrent_handle::in_session()</a>. This will return true before
<a class="reference external" href="reference-Alerts.html#torrent_removed_alert">torrent_removed_alert</a> is posted, and false afterward.</p>
<p>Even though the <tt class="docutils literal">handle</tt> member doesn't point to an existing torrent anymore,
it is still useful for comparing to other handles, which may also no
longer point to existing torrents, but to the same non-existing torrents.</p>
<p>The <tt class="docutils literal">torrent_handle</tt> acts as a <tt class="docutils literal">weak_ptr</tt>, even though its object no
longer exists, it can still compare equal to another weak pointer which
points to the same non-existent object.</p>
<pre class="literal-block">
struct torrent_removed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
   info_hash_t info_hashes;
   client_data_t userdata;
};
</pre>
<a name="userdata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_removed_alert%3A%3A%5Buserdata%5D&labels=documentation&body=Documentation+under+heading+%22torrent_removed_alert%3A%3A%5Buserdata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>userdata</dt>
<dd>'<cite>userdata`</cite> as set in <a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> at torrent creation.
This can be used to associate this torrent with related data
in the client application more efficiently than info_hashes.</dd>
</dl>
<a name="read_piece_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+read_piece_alert&labels=documentation&body=Documentation+under+heading+%22class+read_piece_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="read-piece-alert">
<h1>read_piece_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the asynchronous read operation initiated by
a call to <a class="reference external" href="reference-Torrent_Handle.html#read_piece()">torrent_handle::read_piece()</a> is completed. If the read failed, the torrent
is paused and an error state is set and the buffer member of the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
is 0. If successful, <tt class="docutils literal">buffer</tt> points to a buffer containing all the data
of the piece. <tt class="docutils literal">piece</tt> is the piece index that was read. <tt class="docutils literal">size</tt> is the
number of bytes that was read.</p>
<p>If the operation fails, <tt class="docutils literal">error</tt> will indicate what went wrong.</p>
<pre class="literal-block">
struct read_piece_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
   error_code const error;
   boost::shared_array&lt;char&gt; const buffer;
   piece_index_t const piece;
   int const size;
};
</pre>
<a name="file_completed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_completed_alert&labels=documentation&body=Documentation+under+heading+%22class+file_completed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="file-completed-alert">
<h1>file_completed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This is posted whenever an individual file completes its download. i.e.
All pieces overlapping this file have passed their hash check.</p>
<pre class="literal-block">
struct file_completed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   file_index_t const index;
};
</pre>
<a name="index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_completed_alert%3A%3A%5Bindex%5D&labels=documentation&body=Documentation+under+heading+%22file_completed_alert%3A%3A%5Bindex%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>index</dt>
<dd>refers to the index of the file that completed.</dd>
</dl>
<a name="file_renamed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_renamed_alert&labels=documentation&body=Documentation+under+heading+%22class+file_renamed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="file-renamed-alert">
<h1>file_renamed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This is posted as a response to a <a class="reference external" href="reference-Torrent_Handle.html#rename_file()">torrent_handle::rename_file()</a> call, if the rename
operation succeeds.</p>
<pre class="literal-block">
struct file_renamed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>old_name</strong> () const;
   char const* <strong>new_name</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
   file_index_t const index;
};
</pre>
<a name="new_name()"></a>
<a name="old_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_renamed_alert%3A%3A%5Bnew_name%28%29+old_name%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_renamed_alert%3A%3A%5Bnew_name%28%29+old_name%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="new-name-old-name">
<h2>new_name() old_name()</h2>
<pre class="literal-block">
char const* <strong>old_name</strong> () const;
char const* <strong>new_name</strong> () const;
</pre>
<p>returns the new and previous file name, respectively.</p>
<a name="index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_renamed_alert%3A%3A%5Bindex%5D&labels=documentation&body=Documentation+under+heading+%22file_renamed_alert%3A%3A%5Bindex%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>index</dt>
<dd>refers to the index of the file that was renamed,</dd>
</dl>
<a name="file_rename_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_rename_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+file_rename_failed_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="file-rename-failed-alert">
<h1>file_rename_failed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This is posted as a response to a <a class="reference external" href="reference-Torrent_Handle.html#rename_file()">torrent_handle::rename_file()</a> call, if the rename
operation failed.</p>
<pre class="literal-block">
struct file_rename_failed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
   file_index_t const index;
   error_code const error;
};
</pre>
<a name="index"></a>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_rename_failed_alert%3A%3A%5Bindex+error%5D&labels=documentation&body=Documentation+under+heading+%22file_rename_failed_alert%3A%3A%5Bindex+error%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>index error</dt>
<dd>refers to the index of the file that was supposed to be renamed,
<tt class="docutils literal">error</tt> is the error code returned from the filesystem.</dd>
</dl>
<a name="performance_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+performance_alert&labels=documentation&body=Documentation+under+heading+%22class+performance_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="performance-alert">
<h1>performance_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a limit is reached that might have a negative impact on
upload or download rate performance.</p>
<pre class="literal-block">
struct performance_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   enum performance_warning_t
   {
      outstanding_disk_buffer_limit_reached,
      outstanding_request_limit_reached,
      upload_limit_too_low,
      download_limit_too_low,
      send_buffer_watermark_too_low,
      too_many_optimistic_unchoke_slots,
      too_high_disk_queue_limit,
      aio_limit_reached,
      deprecated_bittyrant_with_no_uplimit,
      too_few_outgoing_ports,
      too_few_file_descriptors,
      num_warnings,
   };

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::performance_warning;
   performance_warning_t const warning_code;
};
</pre>
<a name="performance_warning_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+performance_warning_t&labels=documentation&body=Documentation+under+heading+%22enum+performance_warning_t%22+could+be+improved">report issue</a>]</span><div class="section" id="enum-performance-warning-t">
<h2>enum performance_warning_t</h2>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<table border="1" class="docutils">
<colgroup>
<col width="27%" />
<col width="5%" />
<col width="68%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">value</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>outstanding_disk_buffer_limit_reached</td>
<td>0</td>
<td>This warning means that the number of bytes queued to be written to disk
exceeds the max disk byte queue setting (<tt class="docutils literal"><span class="pre">settings_pack::max_queued_disk_bytes</span></tt>).
This might restrict the download rate, by not queuing up enough write jobs
to the disk I/O thread. When this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted, peer connections are
temporarily stopped from downloading, until the queued disk bytes have fallen
below the limit again. Unless your <tt class="docutils literal">max_queued_disk_bytes</tt> setting is already
high, you might want to increase it to get better performance.</td>
</tr>
<tr><td>outstanding_request_limit_reached</td>
<td>1</td>
<td>This is posted when libtorrent would like to send more requests to a peer,
but it's limited by <tt class="docutils literal"><span class="pre">settings_pack::max_out_request_queue</span></tt>. The queue length
libtorrent is trying to achieve is determined by the download rate and the
assumed round-trip-time (<tt class="docutils literal"><span class="pre">settings_pack::request_queue_time</span></tt>). The assumed
round-trip-time is not limited to just the network RTT, but also the remote disk
access time and message handling time. It defaults to 3 seconds. The target number
of outstanding requests is set to fill the bandwidth-delay product (assumed RTT
times download rate divided by number of bytes per request). When this <a class="reference external" href="reference-Alerts.html#alert">alert</a>
is posted, there is a risk that the number of outstanding requests is too low
and limits the download rate. You might want to increase the <tt class="docutils literal">max_out_request_queue</tt>
setting.</td>
</tr>
<tr><td>upload_limit_too_low</td>
<td>2</td>
<td>This warning is posted when the amount of TCP/IP overhead is greater than the
upload rate limit. When this happens, the TCP/IP overhead is caused by a much
faster download rate, triggering TCP ACK packets. These packets eat into the
rate limit specified to libtorrent. When the overhead traffic is greater than
the rate limit, libtorrent will not be able to send any actual payload, such
as piece requests. This means the download rate will suffer, and new requests
can be sent again. There will be an equilibrium where the download rate, on
average, is about 20 times the upload rate limit. If you want to maximize the
download rate, increase the upload rate limit above 5% of your download capacity.</td>
</tr>
<tr><td>download_limit_too_low</td>
<td>3</td>
<td>This is the same warning as <tt class="docutils literal">upload_limit_too_low</tt> but referring to the download
limit instead of upload. This suggests that your download rate limit is much lower
than your upload capacity. Your upload rate will suffer. To maximize upload rate,
make sure your download rate limit is above 5% of your upload capacity.</td>
</tr>
<tr><td>send_buffer_watermark_too_low</td>
<td>4</td>
<td><p class="first">We're stalled on the disk. We want to write to the socket, and we can write
but our send buffer is empty, waiting to be refilled from the disk.
This either means the disk is slower than the network connection
or that our send buffer watermark is too small, because we can
send it all before the disk gets back to us.
The number of bytes that we keep outstanding, requested from the disk, is calculated
as follows:</p>
<pre class="code C++ literal-block">
<span class="name">min</span><span class="punctuation">(</span><span class="literal number integer">512</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">max</span><span class="punctuation">(</span><span class="name">upload_rate</span><span class="whitespace"> </span><span class="operator">*</span><span class="whitespace"> </span><span class="name">send_buffer_watermark_factor</span><span class="whitespace"> </span><span class="operator">/</span><span class="whitespace"> </span><span class="literal number integer">100</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">send_buffer_watermark</span><span class="punctuation">))</span>
</pre>
<p class="last">If you receive this <a class="reference external" href="reference-Alerts.html#alert">alert</a>, you might want to either increase your <tt class="docutils literal">send_buffer_watermark</tt>
or <tt class="docutils literal">send_buffer_watermark_factor</tt>.</p>
</td>
</tr>
<tr><td>too_many_optimistic_unchoke_slots</td>
<td>5</td>
<td>If the half (or more) of all upload slots are set as optimistic unchoke slots, this
warning is issued. You probably want more regular (rate based) unchoke slots.</td>
</tr>
<tr><td>too_high_disk_queue_limit</td>
<td>6</td>
<td>If the disk write queue ever grows larger than half of the cache size, this warning
is posted. The disk write queue eats into the total disk cache and leaves very little
left for the actual cache. This causes the disk cache to oscillate in evicting large
portions of the cache before allowing peers to download any more, onto the disk write
queue. Either lower <tt class="docutils literal">max_queued_disk_bytes</tt> or increase <tt class="docutils literal">cache_size</tt>.</td>
</tr>
<tr><td>aio_limit_reached</td>
<td>7</td>
<td>&nbsp;</td>
</tr>
<tr><td>deprecated_bittyrant_with_no_uplimit</td>
<td>8</td>
<td>&nbsp;</td>
</tr>
<tr><td>too_few_outgoing_ports</td>
<td>9</td>
<td>This is generated if outgoing peer connections are failing because of <em>address in use</em>
errors, indicating that <tt class="docutils literal"><span class="pre">settings_pack::outgoing_ports</span></tt> is set and is too small of
a range. Consider not using the <tt class="docutils literal">outgoing_ports</tt> setting at all, or widen the range to
include more ports.</td>
</tr>
<tr><td>too_few_file_descriptors</td>
<td>10</td>
<td>&nbsp;</td>
</tr>
<tr><td>num_warnings</td>
<td>11</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<a name="state_changed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+state_changed_alert&labels=documentation&body=Documentation+under+heading+%22class+state_changed_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="state-changed-alert">
<h1>state_changed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>Generated whenever a torrent changes its state.</p>
<pre class="literal-block">
struct state_changed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
   torrent_status::state_t const state;
   torrent_status::state_t const prev_state;
};
</pre>
<a name="state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:state_changed_alert%3A%3A%5Bstate%5D&labels=documentation&body=Documentation+under+heading+%22state_changed_alert%3A%3A%5Bstate%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>state</dt>
<dd>the new state of the torrent.</dd>
</dl>
<a name="prev_state"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:state_changed_alert%3A%3A%5Bprev_state%5D&labels=documentation&body=Documentation+under+heading+%22state_changed_alert%3A%3A%5Bprev_state%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>prev_state</dt>
<dd>the previous state.</dd>
</dl>
<a name="tracker_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_error_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_error_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="tracker-error-alert">
<h1>tracker_error_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated on tracker time outs, premature disconnects,
invalid response or a HTTP response other than &quot;200 OK&quot;. From the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
you can get the handle to the torrent the tracker belongs to.</p>
<pre class="literal-block">
struct tracker_error_alert final : tracker_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>failure_reason</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker | alert_category::error;
   int const times_in_row;
   error_code const error;
   operation_t op;
   protocol_version version;
};
</pre>
<a name="failure_reason()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Bfailure_reason%28%29%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Bfailure_reason%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="failure-reason">
<h2>failure_reason()</h2>
<pre class="literal-block">
char const* <strong>failure_reason</strong> () const;
</pre>
<p>if the tracker sent a &quot;failure reason&quot; string, it will be returned
here.</p>
<a name="times_in_row"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Btimes_in_row%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Btimes_in_row%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>times_in_row</dt>
<dd>This member says how many times in a row this tracker has failed.</dd>
</dl>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error code indicating why the tracker announce failed. If it is
is <tt class="docutils literal"><span class="pre">lt::errors::tracker_failure</span></tt> the <a class="reference external" href="reference-Alerts.html#failure_reason()">failure_reason()</a> might contain
a more detailed description of why the tracker rejected the request.
HTTP status codes indicating errors are also set in this field.</dd>
</dl>
<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_error_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_error_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>version</dt>
<dd>the bittorrent protocol version that was announced</dd>
</dl>
<a name="tracker_warning_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_warning_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_warning_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="tracker-warning-alert">
<h1>tracker_warning_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is triggered if the tracker reply contains a warning field.
Usually this means that the tracker announce was successful, but the
tracker has a message to the client.</p>
<pre class="literal-block">
struct tracker_warning_alert final : tracker_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>warning_message</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker | alert_category::error;
   protocol_version version;
};
</pre>
<a name="warning_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_warning_alert%3A%3A%5Bwarning_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22tracker_warning_alert%3A%3A%5Bwarning_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="warning-message">
<h2>warning_message()</h2>
<pre class="literal-block">
char const* <strong>warning_message</strong> () const;
</pre>
<p>the message associated with this warning</p>
<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_warning_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_warning_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>version</dt>
<dd>the bittorrent protocol version that was announced</dd>
</dl>
<a name="scrape_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+scrape_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+scrape_reply_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="scrape-reply-alert">
<h1>scrape_reply_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a scrape request succeeds.</p>
<pre class="literal-block">
struct scrape_reply_alert final : tracker_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker;
   int const incomplete;
   int const complete;
   protocol_version version;
};
</pre>
<a name="incomplete"></a>
<a name="complete"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_reply_alert%3A%3A%5Bincomplete+complete%5D&labels=documentation&body=Documentation+under+heading+%22scrape_reply_alert%3A%3A%5Bincomplete+complete%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>incomplete complete</dt>
<dd>the data returned in the scrape response. These numbers
may be -1 if the response was malformed.</dd>
</dl>
<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_reply_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22scrape_reply_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>version</dt>
<dd>the bittorrent protocol version that was scraped</dd>
</dl>
<a name="scrape_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+scrape_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+scrape_failed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="scrape-failed-alert">
<h1>scrape_failed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>If a scrape request fails, this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated. This might be due
to the tracker timing out, refusing connection or returning an http response
code indicating an error.</p>
<pre class="literal-block">
struct scrape_failed_alert final : tracker_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>error_message</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker | alert_category::error;
   error_code const error;
   protocol_version version;
};
</pre>
<a name="error_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_failed_alert%3A%3A%5Berror_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22scrape_failed_alert%3A%3A%5Berror_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="error-message">
<h2>error_message()</h2>
<pre class="literal-block">
char const* <strong>error_message</strong> () const;
</pre>
<p>if the error indicates there is an associated message, this returns
that message. Otherwise and empty string.</p>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22scrape_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error itself. This may indicate that the tracker sent an error
message (<tt class="docutils literal"><span class="pre">error::tracker_failure</span></tt>), in which case it can be
retrieved by calling <tt class="docutils literal">error_message()</tt>.</dd>
</dl>
<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:scrape_failed_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22scrape_failed_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>version</dt>
<dd>the bittorrent protocol version that was scraped</dd>
</dl>
<a name="tracker_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_reply_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="tracker-reply-alert">
<h1>tracker_reply_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only for informational purpose. It is generated when a tracker announce
succeeds. It is generated regardless what kind of tracker was used, be it UDP, HTTP or
the DHT.</p>
<pre class="literal-block">
struct tracker_reply_alert final : tracker_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker;
   int const num_peers;
   protocol_version version;
};
</pre>
<a name="num_peers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_reply_alert%3A%3A%5Bnum_peers%5D&labels=documentation&body=Documentation+under+heading+%22tracker_reply_alert%3A%3A%5Bnum_peers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>num_peers</dt>
<dd>tells how many peers the tracker returned in this response. This is
not expected to be greater than the <tt class="docutils literal">num_want</tt> settings. These are not necessarily
all new peers, some of them may already be connected.</dd>
</dl>
<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_reply_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_reply_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>version</dt>
<dd>the bittorrent protocol version that was announced</dd>
</dl>
<a name="dht_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_reply_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-reply-alert">
<h1>dht_reply_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated each time the DHT receives peers from a node. <tt class="docutils literal">num_peers</tt>
is the number of peers we received in this packet. Typically these packets are
received from multiple DHT nodes, and so the alerts are typically generated
a few at a time.</p>
<pre class="literal-block">
struct dht_reply_alert final : tracker_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht | alert_category::tracker;
   int const num_peers;
};
</pre>
<a name="tracker_announce_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_announce_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_announce_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="tracker-announce-alert">
<h1>tracker_announce_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated each time a tracker announce is sent (or attempted to be sent).
There are no extra data members in this <a class="reference external" href="reference-Alerts.html#alert">alert</a>. The url can be found in the base class
however.</p>
<pre class="literal-block">
struct tracker_announce_alert final : tracker_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::tracker;
   event_t const event;
   protocol_version version;
};
</pre>
<a name="event"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_announce_alert%3A%3A%5Bevent%5D&labels=documentation&body=Documentation+under+heading+%22tracker_announce_alert%3A%3A%5Bevent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>event</dt>
<dd>specifies what event was sent to the tracker. See <a class="reference external" href="reference-Core.html#event_t">event_t</a>.</dd>
</dl>
<a name="version"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_announce_alert%3A%3A%5Bversion%5D&labels=documentation&body=Documentation+under+heading+%22tracker_announce_alert%3A%3A%5Bversion%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>version</dt>
<dd>the bittorrent protocol version that is announced</dd>
</dl>
<a name="hash_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+hash_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+hash_failed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="hash-failed-alert">
<h1>hash_failed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a finished piece fails its hash check. You can get the handle
to the torrent which got the failed piece and the index of the piece itself from the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
<pre class="literal-block">
struct hash_failed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
   piece_index_t const piece_index;
};
</pre>
<a name="peer_ban_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_ban_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_ban_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="peer-ban-alert">
<h1>peer_ban_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is banned because it has sent too many corrupt pieces
to us. <tt class="docutils literal">ip</tt> is the endpoint to the peer that was banned.</p>
<pre class="literal-block">
struct peer_ban_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
};
</pre>
<a name="peer_unsnubbed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_unsnubbed_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_unsnubbed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="peer-unsnubbed-alert">
<h1>peer_unsnubbed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is un-snubbed. Essentially when it was snubbed for stalling
sending data, and now it started sending data again.</p>
<pre class="literal-block">
struct peer_unsnubbed_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
};
</pre>
<a name="peer_snubbed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_snubbed_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_snubbed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="peer-snubbed-alert">
<h1>peer_snubbed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is snubbed, when it stops sending data when we request
it.</p>
<pre class="literal-block">
struct peer_snubbed_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
};
</pre>
<a name="peer_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_error_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_error_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="peer-error-alert">
<h1>peer_error_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer sends invalid data over the peer-peer protocol. The peer
will be disconnected, but you get its ip address from the <a class="reference external" href="reference-Alerts.html#alert">alert</a>, to identify it.</p>
<pre class="literal-block">
struct peer_error_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
   operation_t op;
   error_code const error;
};
</pre>
<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_error_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22peer_error_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>op</dt>
<dd>a 0-terminated string of the low-level operation that failed, or nullptr if
there was no low level disk operation.</dd>
</dl>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22peer_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>tells you what error caused this <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</dd>
</dl>
<a name="peer_connect_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_connect_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_connect_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="peer-connect-alert">
<h1>peer_connect_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time an incoming peer connection both
successfully passes the protocol handshake and is associated with a
torrent, or an outgoing peer connection attempt succeeds. For arbitrary
incoming connections, see <a class="reference external" href="reference-Alerts.html#incoming_connection_alert">incoming_connection_alert</a>.</p>
<pre class="literal-block">
struct peer_connect_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   enum direction_t
   {
      in,
      out,
   };

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::connect;
   direction_t direction;
   socket_type_t socket_type;
};
</pre>
<a name="direction_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+direction_t&labels=documentation&body=Documentation+under+heading+%22enum+direction_t%22+could+be+improved">report issue</a>]</span><div class="section" id="enum-direction-t">
<h2>enum direction_t</h2>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<table border="1" class="docutils">
<colgroup>
<col width="23%" />
<col width="27%" />
<col width="50%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">value</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>in</td>
<td>0</td>
<td>&nbsp;</td>
</tr>
<tr><td>out</td>
<td>1</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<a name="direction"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_connect_alert%3A%3A%5Bdirection%5D&labels=documentation&body=Documentation+under+heading+%22peer_connect_alert%3A%3A%5Bdirection%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>direction</dt>
<dd>Tells you if the peer was incoming or outgoing</dd>
</dl>
<a name="peer_disconnected_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_disconnected_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_disconnected_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="peer-disconnected-alert">
<h1>peer_disconnected_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer is disconnected for any reason (other than the ones
covered by <a class="reference external" href="reference-Alerts.html#peer_error_alert">peer_error_alert</a> ).</p>
<pre class="literal-block">
struct peer_disconnected_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::connect;
   socket_type_t const socket_type;
   operation_t const op;
   error_code const error;
   close_reason_t const reason;
};
</pre>
<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>socket_type</dt>
<dd>the kind of socket this peer was connected over</dd>
</dl>
<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>op</dt>
<dd>the operation or level where the error occurred. Specified as an
value from the <a class="reference external" href="reference-Alerts.html#operation_t">operation_t</a> enum. Defined in operations.hpp.</dd>
</dl>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>tells you what error caused peer to disconnect.</dd>
</dl>
<a name="reason"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_disconnected_alert%3A%3A%5Breason%5D&labels=documentation&body=Documentation+under+heading+%22peer_disconnected_alert%3A%3A%5Breason%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>reason</dt>
<dd>the reason the peer disconnected (if specified)</dd>
</dl>
<a name="invalid_request_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+invalid_request_alert&labels=documentation&body=Documentation+under+heading+%22class+invalid_request_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="invalid-request-alert">
<h1>invalid_request_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This is a debug <a class="reference external" href="reference-Alerts.html#alert">alert</a> that is generated by an incoming invalid piece request.
<tt class="docutils literal">ip</tt> is the address of the peer and the <tt class="docutils literal">request</tt> is the actual incoming
request from the peer. See <a class="reference external" href="reference-Core.html#peer_request">peer_request</a> for more info.</p>
<pre class="literal-block">
struct invalid_request_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
   peer_request const request;
   bool const we_have;
   bool const peer_interested;
   bool const withheld;
};
</pre>
<a name="request"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Brequest%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Brequest%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>request</dt>
<dd>the request we received from the peer</dd>
</dl>
<a name="we_have"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Bwe_have%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Bwe_have%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>we_have</dt>
<dd>true if we have this piece</dd>
</dl>
<a name="peer_interested"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Bpeer_interested%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Bpeer_interested%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>peer_interested</dt>
<dd>true if the peer indicated that it was interested to download before
sending the request</dd>
</dl>
<a name="withheld"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:invalid_request_alert%3A%3A%5Bwithheld%5D&labels=documentation&body=Documentation+under+heading+%22invalid_request_alert%3A%3A%5Bwithheld%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>withheld</dt>
<dd>if this is true, the peer is not allowed to download this piece because
of super-seeding rules.</dd>
</dl>
<a name="torrent_finished_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_finished_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_finished_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="torrent-finished-alert">
<h1>torrent_finished_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a torrent switches from being a downloader to a seed.
It will only be generated once per torrent. It contains a <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> to the
torrent in question.</p>
<pre class="literal-block">
struct torrent_finished_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
};
</pre>
<a name="piece_finished_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_finished_alert&labels=documentation&body=Documentation+under+heading+%22class+piece_finished_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="piece-finished-alert">
<h1>piece_finished_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time a piece completes downloading
and passes the hash check. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> derives from <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a>
which contains the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> to the torrent the piece belongs to.
Note that being downloaded and passing the hash check may happen before
the piece is also fully flushed to disk. So <a class="reference external" href="reference-Torrent_Handle.html#have_piece()">torrent_handle::have_piece()</a>
may still return false</p>
<pre class="literal-block">
struct piece_finished_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   piece_index_t const piece_index;
};
</pre>
<a name="piece_index"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_finished_alert%3A%3A%5Bpiece_index%5D&labels=documentation&body=Documentation+under+heading+%22piece_finished_alert%3A%3A%5Bpiece_index%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>piece_index</dt>
<dd>the index of the piece that finished</dd>
</dl>
<a name="request_dropped_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+request_dropped_alert&labels=documentation&body=Documentation+under+heading+%22class+request_dropped_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="request-dropped-alert">
<h1>request_dropped_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a peer rejects or ignores a piece request.</p>
<pre class="literal-block">
struct request_dropped_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   int const block_index;
   piece_index_t const piece_index;
};
</pre>
<a name="block_timeout_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_timeout_alert&labels=documentation&body=Documentation+under+heading+%22class+block_timeout_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="block-timeout-alert">
<h1>block_timeout_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block request times out.</p>
<pre class="literal-block">
struct block_timeout_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   int const block_index;
   piece_index_t const piece_index;
};
</pre>
<a name="block_finished_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_finished_alert&labels=documentation&body=Documentation+under+heading+%22class+block_finished_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="block-finished-alert">
<h1>block_finished_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block request receives a response.</p>
<pre class="literal-block">
struct block_finished_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   int const block_index;
   piece_index_t const piece_index;
};
</pre>
<a name="block_downloading_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_downloading_alert&labels=documentation&body=Documentation+under+heading+%22class+block_downloading_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="block-downloading-alert">
<h1>block_downloading_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block request is sent to a peer.</p>
<pre class="literal-block">
struct block_downloading_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   int const block_index;
   piece_index_t const piece_index;
};
</pre>
<a name="unwanted_block_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+unwanted_block_alert&labels=documentation&body=Documentation+under+heading+%22class+unwanted_block_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="unwanted-block-alert">
<h1>unwanted_block_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a block is received that was not requested or
whose request timed out.</p>
<pre class="literal-block">
struct unwanted_block_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
   int const block_index;
   piece_index_t const piece_index;
};
</pre>
<a name="storage_moved_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_moved_alert&labels=documentation&body=Documentation+under+heading+%22class+storage_moved_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="storage-moved-alert">
<h1>storage_moved_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>The <tt class="docutils literal">storage_moved_alert</tt> is generated when all the disk IO has
completed and the files have been moved, as an effect of a call to
<tt class="docutils literal"><span class="pre">torrent_handle::move_storage</span></tt>. This is useful to synchronize with the
actual disk. The <tt class="docutils literal">storage_path()</tt> member return the new path of the
storage.</p>
<pre class="literal-block">
struct storage_moved_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>storage_path</strong> () const;
   char const* <strong>old_path</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
};
</pre>
<a name="storage_path()"></a>
<a name="old_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_moved_alert%3A%3A%5Bstorage_path%28%29+old_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22storage_moved_alert%3A%3A%5Bstorage_path%28%29+old_path%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="storage-path-old-path">
<h2>storage_path() old_path()</h2>
<pre class="literal-block">
char const* <strong>storage_path</strong> () const;
char const* <strong>old_path</strong> () const;
</pre>
<p>the path the torrent was moved to and from, respectively.</p>
<a name="storage_moved_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+storage_moved_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+storage_moved_failed_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="storage-moved-failed-alert">
<h1>storage_moved_failed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>The <tt class="docutils literal">storage_moved_failed_alert</tt> is generated when an attempt to move the storage,
via <a class="reference external" href="reference-Torrent_Handle.html#move_storage()">torrent_handle::move_storage()</a>, fails.</p>
<pre class="literal-block">
struct storage_moved_failed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>file_path</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
   error_code const error;
   operation_t op;
};
</pre>
<a name="file_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_moved_failed_alert%3A%3A%5Bfile_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22storage_moved_failed_alert%3A%3A%5Bfile_path%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="file-path">
<h2>file_path()</h2>
<pre class="literal-block">
char const* <strong>file_path</strong> () const;
</pre>
<p>If the error happened for a specific file, this returns its path.</p>
<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:storage_moved_failed_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22storage_moved_failed_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>op</dt>
<dd>this indicates what underlying operation caused the error</dd>
</dl>
<a name="torrent_deleted_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_deleted_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_deleted_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="torrent-deleted-alert">
<h1>torrent_deleted_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a request to delete the files of a torrent complete.</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted in the <tt class="docutils literal"><span class="pre">alert_category::storage</span></tt> category, and that bit
needs to be set in the alert_mask.</p>
<pre class="literal-block">
struct torrent_deleted_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
   info_hash_t info_hashes;
};
</pre>
<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_deleted_alert%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_deleted_alert%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>info_hashes</dt>
<dd>The info-hash of the torrent that was just deleted. Most of
the time the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> in the <tt class="docutils literal">torrent_alert</tt> will be invalid by the time
this <a class="reference external" href="reference-Alerts.html#alert">alert</a> arrives, since the torrent is being deleted. The <tt class="docutils literal">info_hashes</tt> member
is hence the main way of identifying which torrent just completed the delete.</dd>
</dl>
<a name="torrent_delete_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_delete_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_delete_failed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="torrent-delete-failed-alert">
<h1>torrent_delete_failed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a request to delete the files of a torrent fails.
Just removing a torrent from the <a class="reference external" href="reference-Session.html#session">session</a> cannot fail</p>
<pre class="literal-block">
struct torrent_delete_failed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage
   | alert_category::error;
   error_code const error;
   info_hash_t info_hashes;
};
</pre>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_delete_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22torrent_delete_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>tells you why it failed.</dd>
</dl>
<a name="info_hashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_delete_failed_alert%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22torrent_delete_failed_alert%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>info_hashes</dt>
<dd>the info hash of the torrent whose files failed to be deleted</dd>
</dl>
<a name="save_resume_data_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+save_resume_data_alert&labels=documentation&body=Documentation+under+heading+%22class+save_resume_data_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="save-resume-data-alert">
<h1>save_resume_data_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated as a response to a <tt class="docutils literal"><span class="pre">torrent_handle::save_resume_data</span></tt> request.
It is generated once the disk IO thread is done writing the state for this torrent.</p>
<pre class="literal-block">
struct save_resume_data_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
   add_torrent_params params;
};
</pre>
<a name="params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:save_resume_data_alert%3A%3A%5Bparams%5D&labels=documentation&body=Documentation+under+heading+%22save_resume_data_alert%3A%3A%5Bparams%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>params</dt>
<dd><p class="first">the <tt class="docutils literal">params</tt> object is populated with the torrent file whose resume
data was saved. It is suitable to be:</p>
<ul class="last simple">
<li>added to a <a class="reference external" href="reference-Session.html#session">session</a> with <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> or <a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a></li>
<li>saved to disk with <a class="reference external" href="reference-Resume_Data.html#write_resume_data()">write_resume_data()</a></li>
<li>turned into a magnet link with <a class="reference external" href="reference-Core.html#make_magnet_uri()">make_magnet_uri()</a></li>
<li>saved as a .torrent file with <a class="reference external" href="reference-Resume_Data.html#write_torrent_file()">write_torrent_file()</a></li>
</ul>
</dd>
</dl>
<a name="save_resume_data_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+save_resume_data_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+save_resume_data_failed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="save-resume-data-failed-alert">
<h1>save_resume_data_failed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated instead of <tt class="docutils literal">save_resume_data_alert</tt> if there was an error
generating the resume data. <tt class="docutils literal">error</tt> describes what went wrong.</p>
<pre class="literal-block">
struct save_resume_data_failed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage
   | alert_category::error;
   error_code const error;
};
</pre>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:save_resume_data_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22save_resume_data_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error code from the resume_data failure</dd>
</dl>
<a name="torrent_paused_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_paused_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_paused_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="torrent-paused-alert">
<h1>torrent_paused_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated as a response to a <tt class="docutils literal"><span class="pre">torrent_handle::pause</span></tt> request. It is
generated once all disk IO is complete and the files in the torrent have been closed.
This is useful for synchronizing with the disk.</p>
<pre class="literal-block">
struct torrent_paused_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
};
</pre>
<a name="torrent_resumed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_resumed_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_resumed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="torrent-resumed-alert">
<h1>torrent_resumed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated as a response to a <a class="reference external" href="reference-Torrent_Handle.html#resume()">torrent_handle::resume()</a> request. It is
generated when a torrent goes from a paused state to an active state.</p>
<pre class="literal-block">
struct torrent_resumed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
};
</pre>
<a name="torrent_checked_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_checked_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_checked_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="torrent-checked-alert">
<h1>torrent_checked_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when a torrent completes checking. i.e. when it transitions
out of the <tt class="docutils literal">checking files</tt> state into a state where it is ready to start downloading</p>
<pre class="literal-block">
struct torrent_checked_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
};
</pre>
<a name="url_seed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+url_seed_alert&labels=documentation&body=Documentation+under+heading+%22class+url_seed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="url-seed-alert">
<h1>url_seed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a HTTP seed name lookup fails.</p>
<pre class="literal-block">
struct url_seed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>server_url</strong> () const;
   char const* <strong>error_message</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer | alert_category::error;
   error_code const error;
};
</pre>
<a name="server_url()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:url_seed_alert%3A%3A%5Bserver_url%28%29%5D&labels=documentation&body=Documentation+under+heading+%22url_seed_alert%3A%3A%5Bserver_url%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="server-url">
<h2>server_url()</h2>
<pre class="literal-block">
char const* <strong>server_url</strong> () const;
</pre>
<p>the URL the error is associated with</p>
<a name="error_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:url_seed_alert%3A%3A%5Berror_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22url_seed_alert%3A%3A%5Berror_message%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="error-message-1">
<h2>error_message()</h2>
<pre class="literal-block">
char const* <strong>error_message</strong> () const;
</pre>
<p>in case the web server sent an error message, this function returns
it.</p>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:url_seed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22url_seed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error the web seed encountered. If this is not set, the server
sent an error message, call <tt class="docutils literal">error_message()</tt>.</dd>
</dl>
<a name="file_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_error_alert&labels=documentation&body=Documentation+under+heading+%22class+file_error_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="file-error-alert">
<h1>file_error_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>If the storage fails to read or write files that it needs access to, this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is
generated and the torrent is paused.</p>
<pre class="literal-block">
struct file_error_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>filename</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status
   | alert_category::storage;
   error_code const error;
   operation_t op;
};
</pre>
<a name="filename()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_error_alert%3A%3A%5Bfilename%28%29%5D&labels=documentation&body=Documentation+under+heading+%22file_error_alert%3A%3A%5Bfilename%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="filename">
<h2>filename()</h2>
<pre class="literal-block">
char const* <strong>filename</strong> () const;
</pre>
<p>the file that experienced the error</p>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22file_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error code describing the error.</dd>
</dl>
<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_error_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22file_error_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>op</dt>
<dd>indicates which underlying operation caused the error</dd>
</dl>
<a name="metadata_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+metadata_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+metadata_failed_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="metadata-failed-alert">
<h1>metadata_failed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when the metadata has been completely received and the info-hash
failed to match it. i.e. the metadata that was received was corrupt. libtorrent will
automatically retry to fetch it in this case. This is only relevant when running a
torrent-less download, with the metadata extension provided by libtorrent.</p>
<pre class="literal-block">
struct metadata_failed_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
   error_code const error;
};
</pre>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:metadata_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22metadata_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>indicates what failed when parsing the metadata. This error is
what's returned from lazy_bdecode().</dd>
</dl>
<a name="metadata_received_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+metadata_received_alert&labels=documentation&body=Documentation+under+heading+%22class+metadata_received_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="metadata-received-alert">
<h1>metadata_received_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when the metadata has been completely received and the torrent
can start downloading. It is not generated on torrents that are started with metadata, but
only those that needs to download it from peers (when utilizing the libtorrent extension).</p>
<p>There are no additional data members in this <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
<p>Typically, when receiving this <a class="reference external" href="reference-Alerts.html#alert">alert</a>, you would want to save the torrent file in order
to load it back up again when the <a class="reference external" href="reference-Session.html#session">session</a> is restarted. Here's an example snippet of
code to do that:</p>
<pre class="code c++ literal-block">
<span class="name">torrent_handle</span><span class="whitespace"> </span><span class="name">h</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">alert</span><span class="operator">-&gt;</span><span class="name">handle</span><span class="punctuation">;</span><span class="whitespace">
</span><span class="name">std</span><span class="operator">::</span><span class="name">shared_ptr</span><span class="operator">&lt;</span><span class="name">torrent_info</span><span class="whitespace"> </span><span class="keyword">const</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">ti</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">h</span><span class="punctuation">.</span><span class="name">torrent_file</span><span class="punctuation">();</span><span class="whitespace">
</span><span class="name">create_torrent</span><span class="whitespace"> </span><span class="name function">ct</span><span class="punctuation">(</span><span class="operator">*</span><span class="name">ti</span><span class="punctuation">);</span><span class="whitespace">
</span><span class="name">entry</span><span class="whitespace"> </span><span class="name">te</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">ct</span><span class="punctuation">.</span><span class="name">generate</span><span class="punctuation">();</span><span class="whitespace">
</span><span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="keyword type">char</span><span class="operator">&gt;</span><span class="whitespace"> </span><span class="name">buffer</span><span class="punctuation">;</span><span class="whitespace">
</span><span class="name">bencode</span><span class="punctuation">(</span><span class="name">std</span><span class="operator">::</span><span class="name">back_inserter</span><span class="punctuation">(</span><span class="name">buffer</span><span class="punctuation">),</span><span class="whitespace"> </span><span class="name">te</span><span class="punctuation">);</span><span class="whitespace">
</span><span class="keyword type">FILE</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">f</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="name">fopen</span><span class="punctuation">((</span><span class="name">to_hex</span><span class="punctuation">(</span><span class="name">ti</span><span class="operator">-&gt;</span><span class="name">info_hashes</span><span class="punctuation">().</span><span class="name">get_best</span><span class="punctuation">().</span><span class="name">to_string</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="operator">+</span><span class="whitespace"> </span><span class="literal string">&quot;.torrent&quot;</span><span class="punctuation">).</span><span class="name">c_str</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="literal string">&quot;wb+&quot;</span><span class="punctuation">);</span><span class="whitespace">
</span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">f</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
        </span><span class="name">fwrite</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">buffer</span><span class="punctuation">[</span><span class="literal number integer">0</span><span class="punctuation">],</span><span class="whitespace"> </span><span class="literal number integer">1</span><span class="punctuation">,</span><span class="whitespace"> </span><span class="name">buffer</span><span class="punctuation">.</span><span class="name">size</span><span class="punctuation">(),</span><span class="whitespace"> </span><span class="name">f</span><span class="punctuation">);</span><span class="whitespace">
        </span><span class="name">fclose</span><span class="punctuation">(</span><span class="name">f</span><span class="punctuation">);</span><span class="whitespace">
</span><span class="punctuation">}</span>
</pre>
<pre class="literal-block">
struct metadata_received_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
};
</pre>
<a name="udp_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+udp_error_alert&labels=documentation&body=Documentation+under+heading+%22class+udp_error_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="udp-error-alert">
<h1>udp_error_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when there is an error on a UDP socket. The
UDP sockets are used for all uTP, DHT and UDP tracker traffic. They are
global to the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
<pre class="literal-block">
struct udp_error_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
   operation_t operation;
   error_code const error;
};
</pre>
<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:udp_error_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22udp_error_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>endpoint</dt>
<dd>the source address associated with the error (if any)</dd>
</dl>
<a name="operation"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:udp_error_alert%3A%3A%5Boperation%5D&labels=documentation&body=Documentation+under+heading+%22udp_error_alert%3A%3A%5Boperation%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>operation</dt>
<dd>the operation that failed</dd>
</dl>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:udp_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22udp_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error code describing the error</dd>
</dl>
<a name="external_ip_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+external_ip_alert&labels=documentation&body=Documentation+under+heading+%22class+external_ip_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="external-ip-alert">
<h1>external_ip_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>Whenever libtorrent learns about the machines external IP, this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is
generated. The external IP address can be acquired from the tracker (if it
supports that) or from peers that supports the extension protocol.
The address can be accessed through the <tt class="docutils literal">external_address</tt> member.</p>
<pre class="literal-block">
struct external_ip_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
   aux::noexcept_movable&lt;address&gt; external_address;
};
</pre>
<a name="external_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:external_ip_alert%3A%3A%5Bexternal_address%5D&labels=documentation&body=Documentation+under+heading+%22external_ip_alert%3A%3A%5Bexternal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>external_address</dt>
<dd>the IP address that is believed to be our external IP</dd>
</dl>
<a name="listen_failed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+listen_failed_alert&labels=documentation&body=Documentation+under+heading+%22class+listen_failed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="listen-failed-alert">
<h1>listen_failed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when none of the ports, given in the port range, to
<a class="reference external" href="reference-Session.html#session">session</a> can be opened for listening. The <tt class="docutils literal">listen_interface</tt> member is the
interface that failed, <tt class="docutils literal">error</tt> is the error code describing the failure.</p>
<p>In the case an endpoint was created before generating the <a class="reference external" href="reference-Alerts.html#alert">alert</a>, it is
represented by <tt class="docutils literal">address</tt> and <tt class="docutils literal">port</tt>. The combinations of socket type
and operation in which such address and port are not valid are:
accept  - i2p
accept  - socks5
enum_if - tcp</p>
<p>libtorrent may sometimes try to listen on port 0, if all other ports failed.
Port 0 asks the operating system to pick a port that's free). If that fails
you may see a <a class="reference external" href="reference-Alerts.html#listen_failed_alert">listen_failed_alert</a> with port 0 even if you didn't ask to
listen on it.</p>
<pre class="literal-block">
struct listen_failed_alert final : alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>listen_interface</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status | alert_category::error;
   error_code const error;
   operation_t op;
   lt::socket_type_t const socket_type;
   aux::noexcept_movable&lt;lt::address&gt; address;
   int const port;
};
</pre>
<a name="listen_interface()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Blisten_interface%28%29%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Blisten_interface%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="listen-interface">
<h2>listen_interface()</h2>
<pre class="literal-block">
char const* <strong>listen_interface</strong> () const;
</pre>
<p>the network device libtorrent attempted to listen on, or the IP address</p>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error the system returned</dd>
</dl>
<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>op</dt>
<dd>the underlying operation that failed</dd>
</dl>
<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>socket_type</dt>
<dd>the type of listen socket this <a class="reference external" href="reference-Alerts.html#alert">alert</a> refers to.</dd>
</dl>
<a name="address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Baddress%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Baddress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>address</dt>
<dd>the address libtorrent attempted to listen on
see <a class="reference external" href="reference-Alerts.html#alert">alert</a> documentation for validity of this value</dd>
</dl>
<a name="port"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_failed_alert%3A%3A%5Bport%5D&labels=documentation&body=Documentation+under+heading+%22listen_failed_alert%3A%3A%5Bport%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>port</dt>
<dd>the port libtorrent attempted to listen on
see <a class="reference external" href="reference-Alerts.html#alert">alert</a> documentation for validity of this value</dd>
</dl>
<a name="listen_succeeded_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+listen_succeeded_alert&labels=documentation&body=Documentation+under+heading+%22class+listen_succeeded_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="listen-succeeded-alert">
<h1>listen_succeeded_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the listen port succeeds to be opened on a
particular interface. <tt class="docutils literal">address</tt> and <tt class="docutils literal">port</tt> is the endpoint that
successfully was opened for listening.</p>
<pre class="literal-block">
struct listen_succeeded_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
   aux::noexcept_movable&lt;lt::address&gt; address;
   int const port;
   lt::socket_type_t const socket_type;
};
</pre>
<a name="address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_succeeded_alert%3A%3A%5Baddress%5D&labels=documentation&body=Documentation+under+heading+%22listen_succeeded_alert%3A%3A%5Baddress%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>address</dt>
<dd>the address libtorrent ended up listening on. This address
refers to the local interface.</dd>
</dl>
<a name="port"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_succeeded_alert%3A%3A%5Bport%5D&labels=documentation&body=Documentation+under+heading+%22listen_succeeded_alert%3A%3A%5Bport%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>port</dt>
<dd>the port libtorrent ended up listening on.</dd>
</dl>
<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:listen_succeeded_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22listen_succeeded_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>socket_type</dt>
<dd>the type of listen socket this <a class="reference external" href="reference-Alerts.html#alert">alert</a> refers to.</dd>
</dl>
<a name="portmap_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+portmap_error_alert&labels=documentation&body=Documentation+under+heading+%22class+portmap_error_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="portmap-error-alert">
<h1>portmap_error_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a NAT router was successfully found but some
part of the port mapping request failed. It contains a text message that
may help the user figure out what is wrong. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is not generated in
case it appears the client is not running on a NAT:ed network or if it
appears there is no NAT router that can be remote controlled to add port
mappings.</p>
<pre class="literal-block">
struct portmap_error_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::port_mapping
   | alert_category::error;
   port_mapping_t const mapping;
   portmap_transport map_transport;
   aux::noexcept_movable&lt;address&gt; local_address;
   error_code const error;
};
</pre>
<a name="mapping"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Bmapping%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Bmapping%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>mapping</dt>
<dd>refers to the mapping index of the port map that failed, i.e.
the index returned from add_mapping().</dd>
</dl>
<a name="map_transport"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Bmap_transport%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Bmap_transport%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>map_transport</dt>
<dd>UPnP or NAT-PMP</dd>
</dl>
<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>local_address</dt>
<dd>the local network the port mapper is running on</dd>
</dl>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22portmap_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>tells you what failed.</dd>
</dl>
<a name="portmap_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+portmap_alert&labels=documentation&body=Documentation+under+heading+%22class+portmap_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="portmap-alert">
<h1>portmap_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a NAT router was successfully found and
a port was successfully mapped on it. On a NAT:ed network with a NAT-PMP
capable router, this is typically generated once when mapping the TCP
port and, if DHT is enabled, when the UDP port is mapped.</p>
<pre class="literal-block">
struct portmap_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::port_mapping;
   port_mapping_t const mapping;
   int const external_port;
   portmap_protocol const map_protocol;
   portmap_transport const map_transport;
   aux::noexcept_movable&lt;address&gt; local_address;
};
</pre>
<a name="mapping"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_alert%3A%3A%5Bmapping%5D&labels=documentation&body=Documentation+under+heading+%22portmap_alert%3A%3A%5Bmapping%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>mapping</dt>
<dd>refers to the mapping index of the port map that failed, i.e.
the index returned from add_mapping().</dd>
</dl>
<a name="external_port"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_alert%3A%3A%5Bexternal_port%5D&labels=documentation&body=Documentation+under+heading+%22portmap_alert%3A%3A%5Bexternal_port%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>external_port</dt>
<dd>the external port allocated for the mapping.</dd>
</dl>
<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22portmap_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>local_address</dt>
<dd>the local network the port mapper is running on</dd>
</dl>
<a name="portmap_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+portmap_log_alert&labels=documentation&body=Documentation+under+heading+%22class+portmap_log_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="portmap-log-alert">
<h1>portmap_log_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated to log informational events related to either
UPnP or NAT-PMP. They contain a log line and the type (0 = NAT-PMP
and 1 = UPnP). Displaying these messages to an end user is only useful
for debugging the UPnP or NAT-PMP implementation. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only
posted if the alert_category::port_mapping_log flag is enabled in
the <a class="reference external" href="reference-Alerts.html#alert">alert</a> mask.</p>
<pre class="literal-block">
struct portmap_log_alert final : alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>log_message</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::port_mapping_log;
   portmap_transport const map_transport;
   aux::noexcept_movable&lt;address&gt; local_address;
};
</pre>
<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22portmap_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message">
<h2>log_message()</h2>
<pre class="literal-block">
char const* <strong>log_message</strong> () const;
</pre>
<p>the message associated with this log line</p>
<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:portmap_log_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22portmap_log_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>local_address</dt>
<dd>the local network the port mapper is running on</dd>
</dl>
<a name="fastresume_rejected_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+fastresume_rejected_alert&labels=documentation&body=Documentation+under+heading+%22class+fastresume_rejected_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="fastresume-rejected-alert">
<h1>fastresume_rejected_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a fast resume file has been passed to
<a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> but the files on disk did not match the fast resume file.
The error_code explains the reason why the resume file was rejected.</p>
<pre class="literal-block">
struct fastresume_rejected_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>file_path</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status
   | alert_category::error;
   error_code error;
   operation_t op;
};
</pre>
<a name="file_path()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:fastresume_rejected_alert%3A%3A%5Bfile_path%28%29%5D&labels=documentation&body=Documentation+under+heading+%22fastresume_rejected_alert%3A%3A%5Bfile_path%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="file-path-1">
<h2>file_path()</h2>
<pre class="literal-block">
char const* <strong>file_path</strong> () const;
</pre>
<p>If the error happened to a specific file, this returns the path to it.</p>
<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:fastresume_rejected_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22fastresume_rejected_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>op</dt>
<dd>the underlying operation that failed</dd>
</dl>
<a name="peer_blocked_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_blocked_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_blocked_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="peer-blocked-alert">
<h1>peer_blocked_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when an incoming peer connection, or a peer that's about to be added
to our peer list, is blocked for some reason. This could be any of:</p>
<ul class="simple">
<li>the IP filter</li>
<li>i2p mixed mode restrictions (a normal peer is not allowed on an i2p swarm)</li>
<li>the port filter</li>
<li>the peer has a low port and <tt class="docutils literal">no_connect_privileged_ports</tt> is enabled</li>
<li>the protocol of the peer is blocked (uTP/TCP blocking)</li>
</ul>
<pre class="literal-block">
struct peer_blocked_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   enum reason_t
   {
      ip_filter,
      port_filter,
      i2p_mixed,
      privileged_ports,
      utp_disabled,
      tcp_disabled,
      invalid_local_interface,
      ssrf_mitigation,
   };

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::ip_block;
   int const reason;
};
</pre>
<a name="reason_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+reason_t&labels=documentation&body=Documentation+under+heading+%22enum+reason_t%22+could+be+improved">report issue</a>]</span><div class="section" id="enum-reason-t">
<h2>enum reason_t</h2>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<table border="1" class="docutils">
<colgroup>
<col width="56%" />
<col width="16%" />
<col width="29%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">value</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>ip_filter</td>
<td>0</td>
<td>&nbsp;</td>
</tr>
<tr><td>port_filter</td>
<td>1</td>
<td>&nbsp;</td>
</tr>
<tr><td>i2p_mixed</td>
<td>2</td>
<td>&nbsp;</td>
</tr>
<tr><td>privileged_ports</td>
<td>3</td>
<td>&nbsp;</td>
</tr>
<tr><td>utp_disabled</td>
<td>4</td>
<td>&nbsp;</td>
</tr>
<tr><td>tcp_disabled</td>
<td>5</td>
<td>&nbsp;</td>
</tr>
<tr><td>invalid_local_interface</td>
<td>6</td>
<td>&nbsp;</td>
</tr>
<tr><td>ssrf_mitigation</td>
<td>7</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<a name="reason"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_blocked_alert%3A%3A%5Breason%5D&labels=documentation&body=Documentation+under+heading+%22peer_blocked_alert%3A%3A%5Breason%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>reason</dt>
<dd>the reason for the peer being blocked. Is one of the values from the
<a class="reference external" href="reference-Alerts.html#reason_t">reason_t</a> enum.</dd>
</dl>
<a name="dht_announce_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_announce_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_announce_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="dht-announce-alert">
<h1>dht_announce_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a DHT node announces to an info-hash on our
DHT node. It belongs to the <tt class="docutils literal"><span class="pre">alert_category::dht</span></tt> category.</p>
<pre class="literal-block">
struct dht_announce_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
   aux::noexcept_movable&lt;address&gt; ip;
   int port;
   sha1_hash info_hash;
};
</pre>
<a name="dht_get_peers_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_get_peers_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_get_peers_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-get-peers-alert">
<h1>dht_get_peers_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when a DHT node sends a <tt class="docutils literal">get_peers</tt> message to
our DHT node. It belongs to the <tt class="docutils literal"><span class="pre">alert_category::dht</span></tt> category.</p>
<pre class="literal-block">
struct dht_get_peers_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
   sha1_hash info_hash;
};
</pre>
<a name="cache_flushed_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+cache_flushed_alert&labels=documentation&body=Documentation+under+heading+%22class+cache_flushed_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="cache-flushed-alert">
<h1>cache_flushed_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the disk cache has been flushed for a specific
torrent as a result of a call to <a class="reference external" href="reference-Torrent_Handle.html#flush_cache()">torrent_handle::flush_cache()</a>. This
<a class="reference external" href="reference-Alerts.html#alert">alert</a> belongs to the <tt class="docutils literal"><span class="pre">alert_category::storage</span></tt> category, which must be
enabled to let this <a class="reference external" href="reference-Alerts.html#alert">alert</a> through. The <a class="reference external" href="reference-Alerts.html#alert">alert</a> is also posted when removing
a torrent from the <a class="reference external" href="reference-Session.html#session">session</a>, once the outstanding cache flush is complete
and the torrent does no longer have any files open.</p>
<pre class="literal-block">
struct cache_flushed_alert final : torrent_alert
{
   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
};
</pre>
<a name="lsd_peer_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+lsd_peer_alert&labels=documentation&body=Documentation+under+heading+%22class+lsd_peer_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="lsd-peer-alert">
<h1>lsd_peer_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when we receive a local service discovery message
from a peer for a torrent we're currently participating in.</p>
<pre class="literal-block">
struct lsd_peer_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
};
</pre>
<a name="trackerid_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+trackerid_alert&labels=documentation&body=Documentation+under+heading+%22class+trackerid_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="trackerid-alert">
<h1>trackerid_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted whenever a tracker responds with a <tt class="docutils literal">trackerid</tt>.
The tracker ID is like a cookie. libtorrent will store the tracker ID
for this tracker and repeat it in subsequent announces.</p>
<pre class="literal-block">
struct trackerid_alert final : tracker_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>tracker_id</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
};
</pre>
<a name="tracker_id()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:trackerid_alert%3A%3A%5Btracker_id%28%29%5D&labels=documentation&body=Documentation+under+heading+%22trackerid_alert%3A%3A%5Btracker_id%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="tracker-id">
<h2>tracker_id()</h2>
<pre class="literal-block">
char const* <strong>tracker_id</strong> () const;
</pre>
<p>The tracker ID returned by the tracker</p>
<a name="dht_bootstrap_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_bootstrap_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_bootstrap_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="dht-bootstrap-alert">
<h1>dht_bootstrap_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the initial DHT bootstrap is done.</p>
<pre class="literal-block">
struct dht_bootstrap_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
};
</pre>
<a name="torrent_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_error_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_error_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="torrent-error-alert">
<h1>torrent_error_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This is posted whenever a torrent is transitioned into the error state.
If the error code is duplicate_torrent (<a class="reference external" href="reference-Error_Codes.html#error_code_enum">error_code_enum</a>) error, it suggests two magnet
links ended up resolving to the same hybrid torrent. For more details,
see <a class="reference external" href="manual-ref.html#bittorrent-v2-torrents">BitTorrent v2 torrents</a>.</p>
<pre class="literal-block">
struct torrent_error_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>filename</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error | alert_category::status;
   error_code const error;
};
</pre>
<a name="filename()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_error_alert%3A%3A%5Bfilename%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_error_alert%3A%3A%5Bfilename%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="filename-1">
<h2>filename()</h2>
<pre class="literal-block">
char const* <strong>filename</strong> () const;
</pre>
<p>the filename (or object) the error occurred on.</p>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22torrent_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>specifies which error the torrent encountered.</dd>
</dl>
<a name="torrent_need_cert_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_need_cert_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_need_cert_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="torrent-need-cert-alert">
<h1>torrent_need_cert_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This is always posted for SSL torrents. This is a reminder to the client that
the torrent won't work unless <a class="reference external" href="reference-Torrent_Handle.html#set_ssl_certificate()">torrent_handle::set_ssl_certificate()</a> is called with
a valid certificate. Valid certificates MUST be signed by the SSL certificate
in the .torrent file.</p>
<pre class="literal-block">
struct torrent_need_cert_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
};
</pre>
<a name="incoming_connection_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+incoming_connection_alert&labels=documentation&body=Documentation+under+heading+%22class+incoming_connection_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="incoming-connection-alert">
<h1>incoming_connection_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>The incoming connection <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time we successfully accept
an incoming connection, through any mean. The most straight-forward ways
of accepting incoming connections are through the TCP listen socket and
the UDP listen socket for uTP sockets. However, connections may also be
accepted through a Socks5 or i2p listen socket, or via an SSL listen
socket.</p>
<pre class="literal-block">
struct incoming_connection_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer;
   socket_type_t socket_type;
   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; endpoint;
};
</pre>
<a name="socket_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:incoming_connection_alert%3A%3A%5Bsocket_type%5D&labels=documentation&body=Documentation+under+heading+%22incoming_connection_alert%3A%3A%5Bsocket_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>socket_type</dt>
<dd>tells you what kind of socket the connection was accepted</dd>
</dl>
<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:incoming_connection_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22incoming_connection_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>endpoint</dt>
<dd>is the IP address and port the connection came from.</dd>
</dl>
<a name="add_torrent_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+add_torrent_alert&labels=documentation&body=Documentation+under+heading+%22class+add_torrent_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="add-torrent-alert">
<h1>add_torrent_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is always posted when a torrent was attempted to be added
and contains the return status of the add operation. The torrent handle of the new
torrent can be found as the <tt class="docutils literal">handle</tt> member in the base class. If adding
the torrent failed, <tt class="docutils literal">error</tt> contains the error code.</p>
<pre class="literal-block">
struct add_torrent_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
   add_torrent_params params;
   error_code error;
};
</pre>
<a name="params"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_alert%3A%3A%5Bparams%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_alert%3A%3A%5Bparams%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>params</dt>
<dd><p class="first">This contains copies of the most important fields from the original
<a class="reference external" href="reference-Add_Torrent.html#add_torrent_params">add_torrent_params</a> object, passed to <a class="reference external" href="reference-Session.html#add_torrent()">add_torrent()</a> or
<a class="reference external" href="reference-Session.html#async_add_torrent()">async_add_torrent()</a>. Specifically, these fields are copied:</p>
<ul class="simple">
<li>version</li>
<li>ti</li>
<li>name</li>
<li>save_path</li>
<li>userdata</li>
<li>tracker_id</li>
<li>flags</li>
<li>info_hash</li>
</ul>
<p class="last">the info_hash field will be updated with the info-hash of the torrent
specified by <tt class="docutils literal">ti</tt>.</p>
</dd>
</dl>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:add_torrent_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22add_torrent_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>set to the error, if one occurred while adding the torrent.</dd>
</dl>
<a name="state_update_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+state_update_alert&labels=documentation&body=Documentation+under+heading+%22class+state_update_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="state-update-alert">
<h1>state_update_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only posted when requested by the user, by calling
session::post_torrent_updates() on the <a class="reference external" href="reference-Session.html#session">session</a>. It contains the torrent
status of all torrents that changed since last time this message was
posted. Its category is <tt class="docutils literal"><span class="pre">alert_category::status</span></tt>, but it's not subject to
filtering, since it's only manually posted anyway.</p>
<pre class="literal-block">
struct state_update_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
   std::vector&lt;torrent_status&gt; status;
};
</pre>
<a name="status"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:state_update_alert%3A%3A%5Bstatus%5D&labels=documentation&body=Documentation+under+heading+%22state_update_alert%3A%3A%5Bstatus%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>status</dt>
<dd>contains the torrent status of all torrents that changed since last
time this message was posted. Note that you can map a torrent status
to a specific torrent via its <tt class="docutils literal">handle</tt> member. The receiving end is
suggested to have all torrents sorted by the <a class="reference external" href="reference-Torrent_Handle.html#torrent_handle">torrent_handle</a> or hashed
by it, for efficient updates.</dd>
</dl>
<a name="session_stats_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_stats_alert&labels=documentation&body=Documentation+under+heading+%22class+session_stats_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="session-stats-alert">
<h1>session_stats_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>The <a class="reference external" href="reference-Alerts.html#session_stats_alert">session_stats_alert</a> is posted when the user requests <a class="reference external" href="reference-Session.html#session">session</a> statistics by
calling <a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a> on the <a class="reference external" href="reference-Session.html#session">session</a> object. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> does not
have a category, since it's only posted in response to an API call. It
is not subject to the alert_mask filter.</p>
<p>the <tt class="docutils literal">message()</tt> member function returns a string representation of the values that
properly match the line returned in <tt class="docutils literal"><span class="pre">session_stats_header_alert::message()</span></tt>.</p>
<p>this specific output is parsed by tools/parse_session_stats.py
if this is changed, that parser should also be changed</p>
<pre class="literal-block">
struct session_stats_alert final : alert
{
   std::string <strong>message</strong> () const override;
   span&lt;std::int64_t const&gt; <strong>counters</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = {};
};
</pre>
<a name="counters()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_stats_alert%3A%3A%5Bcounters%28%29%5D&labels=documentation&body=Documentation+under+heading+%22session_stats_alert%3A%3A%5Bcounters%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="counters">
<h2>counters()</h2>
<pre class="literal-block">
span&lt;std::int64_t const&gt; <strong>counters</strong> () const;
</pre>
<p>An array are a mix of <em>counters</em> and <em>gauges</em>, which meanings can be
queries via the <a class="reference external" href="reference-Stats.html#session_stats_metrics()">session_stats_metrics()</a> function on the <a class="reference external" href="reference-Session.html#session">session</a>. The
mapping from a specific metric to an index into this array is constant
for a specific version of libtorrent, but may differ for other
versions. The intended usage is to request the mapping, i.e. call
<a class="reference external" href="reference-Stats.html#session_stats_metrics()">session_stats_metrics()</a>, once on startup, and then use that mapping to
interpret these values throughout the process' runtime.</p>
<p>For more information, see the <a class="reference external" href="manual-ref.html#session-statistics">session statistics</a> section.</p>
<a name="dht_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_error_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_error_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="dht-error-alert">
<h1>dht_error_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted when something fails in the DHT. This is not necessarily a fatal
error, but it could prevent proper operation</p>
<pre class="literal-block">
struct dht_error_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error | alert_category::dht;
   error_code error;
   operation_t op;
};
</pre>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22dht_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error code</dd>
</dl>
<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_error_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22dht_error_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>op</dt>
<dd>the operation that failed</dd>
</dl>
<a name="dht_immutable_item_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_immutable_item_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_immutable_item_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-immutable-item-alert">
<h1>dht_immutable_item_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted as a response to a call to session::get_item(),
specifically the overload for looking up immutable items in the DHT.</p>
<pre class="literal-block">
struct dht_immutable_item_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
   sha1_hash target;
   entry item;
};
</pre>
<a name="target"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_immutable_item_alert%3A%3A%5Btarget%5D&labels=documentation&body=Documentation+under+heading+%22dht_immutable_item_alert%3A%3A%5Btarget%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>target</dt>
<dd>the target hash of the immutable item. This must
match the SHA-1 hash of the bencoded form of <tt class="docutils literal">item</tt>.</dd>
</dl>
<a name="item"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_immutable_item_alert%3A%3A%5Bitem%5D&labels=documentation&body=Documentation+under+heading+%22dht_immutable_item_alert%3A%3A%5Bitem%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>item</dt>
<dd>the data for this item</dd>
</dl>
<a name="dht_mutable_item_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_mutable_item_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_mutable_item_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-mutable-item-alert">
<h1>dht_mutable_item_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted as a response to a call to session::get_item(),
specifically the overload for looking up mutable items in the DHT.</p>
<pre class="literal-block">
struct dht_mutable_item_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
   std::array&lt;char, 32&gt; key;
   std::array&lt;char, 64&gt; signature;
   std::int64_t seq;
   std::string salt;
   entry item;
   bool authoritative;
};
</pre>
<a name="key"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bkey%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bkey%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>key</dt>
<dd>the public key that was looked up</dd>
</dl>
<a name="signature"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bsignature%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bsignature%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>signature</dt>
<dd>the signature of the data. This is not the signature of the
plain encoded form of the item, but it includes the sequence number
and possibly the hash as well. See the dht_store document for more
information. This is primarily useful for echoing back in a store
request.</dd>
</dl>
<a name="seq"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bseq%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bseq%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>seq</dt>
<dd>the sequence number of this item</dd>
</dl>
<a name="salt"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bsalt%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bsalt%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>salt</dt>
<dd>the salt, if any, used to lookup and store this item. If no
salt was used, this is an empty string</dd>
</dl>
<a name="item"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bitem%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bitem%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>item</dt>
<dd>the data for this item</dd>
</dl>
<a name="authoritative"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_mutable_item_alert%3A%3A%5Bauthoritative%5D&labels=documentation&body=Documentation+under+heading+%22dht_mutable_item_alert%3A%3A%5Bauthoritative%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>authoritative</dt>
<dd>the last response for mutable data is authoritative.</dd>
</dl>
<a name="dht_put_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_put_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_put_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-put-alert">
<h1>dht_put_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this is posted when a DHT put operation completes. This is useful if the
client is waiting for a put to complete before shutting down for instance.</p>
<pre class="literal-block">
struct dht_put_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
   sha1_hash target;
   std::array&lt;char, 32&gt; public_key;
   std::array&lt;char, 64&gt; signature;
   std::string salt;
   std::int64_t seq;
   int num_success;
};
</pre>
<a name="target"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_put_alert%3A%3A%5Btarget%5D&labels=documentation&body=Documentation+under+heading+%22dht_put_alert%3A%3A%5Btarget%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>target</dt>
<dd>the target hash the item was stored under if this was an <em>immutable</em>
item.</dd>
</dl>
<a name="public_key"></a>
<a name="signature"></a>
<a name="salt"></a>
<a name="seq"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_put_alert%3A%3A%5Bpublic_key+signature+salt+seq%5D&labels=documentation&body=Documentation+under+heading+%22dht_put_alert%3A%3A%5Bpublic_key+signature+salt+seq%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>public_key signature salt seq</dt>
<dd>if a mutable item was stored, these are the public key, signature,
salt and sequence number the item was stored under.</dd>
</dl>
<a name="num_success"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_put_alert%3A%3A%5Bnum_success%5D&labels=documentation&body=Documentation+under+heading+%22dht_put_alert%3A%3A%5Bnum_success%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>num_success</dt>
<dd>DHT put operation usually writes item to k nodes, maybe the node
is stale so no response, or the node doesn't support 'put', or the
token for write is out of date, etc. num_success is the number of
successful responses we got from the puts.</dd>
</dl>
<a name="i2p_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+i2p_alert&labels=documentation&body=Documentation+under+heading+%22class+i2p_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="i2p-alert">
<h1>i2p_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is used to report errors in the i2p SAM connection</p>
<pre class="literal-block">
struct i2p_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
   error_code error;
};
</pre>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:i2p_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22i2p_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error that occurred in the i2p SAM connection</dd>
</dl>
<a name="dht_outgoing_get_peers_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_outgoing_get_peers_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_outgoing_get_peers_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-outgoing-get-peers-alert">
<h1>dht_outgoing_get_peers_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is generated when we send a get_peers request
It belongs to the <tt class="docutils literal"><span class="pre">alert_category::dht</span></tt> category.</p>
<pre class="literal-block">
struct dht_outgoing_get_peers_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
   sha1_hash info_hash;
   sha1_hash obfuscated_info_hash;
   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
};
</pre>
<a name="info_hash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_outgoing_get_peers_alert%3A%3A%5Binfo_hash%5D&labels=documentation&body=Documentation+under+heading+%22dht_outgoing_get_peers_alert%3A%3A%5Binfo_hash%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>info_hash</dt>
<dd>the info_hash of the torrent we're looking for peers for.</dd>
</dl>
<a name="obfuscated_info_hash"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_outgoing_get_peers_alert%3A%3A%5Bobfuscated_info_hash%5D&labels=documentation&body=Documentation+under+heading+%22dht_outgoing_get_peers_alert%3A%3A%5Bobfuscated_info_hash%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>obfuscated_info_hash</dt>
<dd>if this was an obfuscated lookup, this is the info-hash target
actually sent to the node.</dd>
</dl>
<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_outgoing_get_peers_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22dht_outgoing_get_peers_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>endpoint</dt>
<dd>the endpoint we're sending this query to</dd>
</dl>
<a name="log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+log_alert&labels=documentation&body=Documentation+under+heading+%22class+log_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="log-alert">
<h1>log_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted by some <a class="reference external" href="reference-Session.html#session">session</a> wide event. Its main purpose is
trouble shooting and debugging. It's not enabled by the default <a class="reference external" href="reference-Alerts.html#alert">alert</a>
mask and is enabled by the <tt class="docutils literal"><span class="pre">alert_category::session_log</span></tt> bit.
Furthermore, it's by default disabled as a build configuration.</p>
<pre class="literal-block">
struct log_alert final : alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>log_message</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::session_log;
};
</pre>
<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-1">
<h2>log_message()</h2>
<pre class="literal-block">
char const* <strong>log_message</strong> () const;
</pre>
<p>returns the log message</p>
<a name="torrent_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_log_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_log_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="torrent-log-alert">
<h1>torrent_log_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted by torrent wide events. It's meant to be used for
trouble shooting and debugging. It's not enabled by the default <a class="reference external" href="reference-Alerts.html#alert">alert</a>
mask and is enabled by the <tt class="docutils literal"><span class="pre">alert_category::torrent_log</span></tt> bit. By
default it is disabled as a build configuration.</p>
<pre class="literal-block">
struct torrent_log_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>log_message</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::torrent_log;
};
</pre>
<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22torrent_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-2">
<h2>log_message()</h2>
<pre class="literal-block">
char const* <strong>log_message</strong> () const;
</pre>
<p>returns the log message</p>
<a name="peer_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_log_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_log_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="peer-log-alert">
<h1>peer_log_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted by events specific to a peer. It's meant to be used
for trouble shooting and debugging. It's not enabled by the default <a class="reference external" href="reference-Alerts.html#alert">alert</a>
mask and is enabled by the <tt class="docutils literal"><span class="pre">alert_category::peer_log</span></tt> bit. By
default it is disabled as a build configuration.</p>
<pre class="literal-block">
struct peer_log_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>log_message</strong> () const;

   enum direction_t
   {
      incoming_message,
      outgoing_message,
      incoming,
      outgoing,
      info,
   };

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::peer_log;
   char const* event_type;
   direction_t direction;
};
</pre>
<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22peer_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-3">
<h2>log_message()</h2>
<pre class="literal-block">
char const* <strong>log_message</strong> () const;
</pre>
<p>returns the log message</p>
<a name="direction_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+direction_t&labels=documentation&body=Documentation+under+heading+%22enum+direction_t%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="enum-direction-t-1">
<h2>enum direction_t</h2>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<table border="1" class="docutils">
<colgroup>
<col width="47%" />
<col width="18%" />
<col width="34%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">value</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>incoming_message</td>
<td>0</td>
<td>&nbsp;</td>
</tr>
<tr><td>outgoing_message</td>
<td>1</td>
<td>&nbsp;</td>
</tr>
<tr><td>incoming</td>
<td>2</td>
<td>&nbsp;</td>
</tr>
<tr><td>outgoing</td>
<td>3</td>
<td>&nbsp;</td>
</tr>
<tr><td>info</td>
<td>4</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<a name="event_type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_log_alert%3A%3A%5Bevent_type%5D&labels=documentation&body=Documentation+under+heading+%22peer_log_alert%3A%3A%5Bevent_type%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>event_type</dt>
<dd>string literal indicating the kind of event. For messages, this is the
message name.</dd>
</dl>
<a name="lsd_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+lsd_error_alert&labels=documentation&body=Documentation+under+heading+%22class+lsd_error_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="lsd-error-alert">
<h1>lsd_error_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted if the local service discovery socket fails to start properly.
it's categorized as <tt class="docutils literal"><span class="pre">alert_category::error</span></tt>.</p>
<pre class="literal-block">
struct lsd_error_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
   aux::noexcept_movable&lt;address&gt; local_address;
   error_code error;
};
</pre>
<a name="local_address"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:lsd_error_alert%3A%3A%5Blocal_address%5D&labels=documentation&body=Documentation+under+heading+%22lsd_error_alert%3A%3A%5Blocal_address%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>local_address</dt>
<dd>the local network the corresponding local service discovery is running
on</dd>
</dl>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:lsd_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22lsd_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>The error code</dd>
</dl>
<a name="dht_lookup"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_lookup&labels=documentation&body=Documentation+under+heading+%22class+dht_lookup%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-lookup">
<h1>dht_lookup</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>holds statistics about a current <a class="reference external" href="reference-Alerts.html#dht_lookup">dht_lookup</a> operation.
a DHT lookup is the traversal of nodes, looking up a
set of target nodes in the DHT for retrieving and possibly
storing information in the DHT</p>
<pre class="literal-block">
struct dht_lookup
{
   char const* type;
   int outstanding_requests;
   int timeouts;
   int responses;
   int branch_factor;
   int nodes_left;
   int last_sent;
   int first_timeout;
   sha1_hash target;
};
</pre>
<a name="type"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Btype%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Btype%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>type</dt>
<dd>string literal indicating which kind of lookup this is</dd>
</dl>
<a name="outstanding_requests"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Boutstanding_requests%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Boutstanding_requests%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>outstanding_requests</dt>
<dd>the number of outstanding request to individual nodes
this lookup has right now</dd>
</dl>
<a name="timeouts"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Btimeouts%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Btimeouts%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>timeouts</dt>
<dd>the total number of requests that have timed out so far
for this lookup</dd>
</dl>
<a name="responses"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bresponses%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bresponses%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>responses</dt>
<dd>the total number of responses we have received for this
lookup so far for this lookup</dd>
</dl>
<a name="branch_factor"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bbranch_factor%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bbranch_factor%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>branch_factor</dt>
<dd>the branch factor for this lookup. This is the number of
nodes we keep outstanding requests to in parallel by default.
when nodes time out we may increase this.</dd>
</dl>
<a name="nodes_left"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bnodes_left%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bnodes_left%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>nodes_left</dt>
<dd>the number of nodes left that could be queries for this
lookup. Many of these are likely to be part of the trail
while performing the lookup and would never end up actually
being queried.</dd>
</dl>
<a name="last_sent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Blast_sent%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Blast_sent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>last_sent</dt>
<dd>the number of seconds ago the
last message was sent that's still
outstanding</dd>
</dl>
<a name="first_timeout"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Bfirst_timeout%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Bfirst_timeout%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>first_timeout</dt>
<dd>the number of outstanding requests
that have exceeded the short timeout
and are considered timed out in the
sense that they increased the branch
factor</dd>
</dl>
<a name="target"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_lookup%3A%3A%5Btarget%5D&labels=documentation&body=Documentation+under+heading+%22dht_lookup%3A%3A%5Btarget%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>target</dt>
<dd>the node-id or info-hash target for this lookup</dd>
</dl>
<a name="dht_stats_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_stats_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_stats_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-stats-alert">
<h1>dht_stats_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>contains current DHT state. Posted in response to session::post_dht_stats().</p>
<pre class="literal-block">
struct dht_stats_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = {};
   std::vector&lt;dht_lookup&gt; active_requests;
   std::vector&lt;dht_routing_bucket&gt; routing_table;
   sha1_hash nid;
   aux::noexcept_movable&lt;udp::endpoint&gt; local_endpoint;
};
</pre>
<a name="active_requests"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Bactive_requests%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Bactive_requests%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>active_requests</dt>
<dd>a vector of the currently running DHT lookups.</dd>
</dl>
<a name="routing_table"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Brouting_table%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Brouting_table%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>routing_table</dt>
<dd>contains information about every bucket in the DHT routing
table.</dd>
</dl>
<a name="nid"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Bnid%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Bnid%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>nid</dt>
<dd>the node ID of the DHT node instance</dd>
</dl>
<a name="local_endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_stats_alert%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22dht_stats_alert%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>local_endpoint</dt>
<dd>the local socket this DHT node is running on</dd>
</dl>
<a name="incoming_request_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+incoming_request_alert&labels=documentation&body=Documentation+under+heading+%22class+incoming_request_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="incoming-request-alert">
<h1>incoming_request_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted every time an incoming request from a peer is accepted and queued
up for being serviced. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is only posted if
the alert_category::incoming_request flag is enabled in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
mask.</p>
<pre class="literal-block">
struct incoming_request_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::incoming_request;
   peer_request req;
};
</pre>
<a name="req"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:incoming_request_alert%3A%3A%5Breq%5D&labels=documentation&body=Documentation+under+heading+%22incoming_request_alert%3A%3A%5Breq%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>req</dt>
<dd>the request this peer sent to us</dd>
</dl>
<a name="dht_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_log_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_log_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-log-alert">
<h1>dht_log_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>debug logging of the DHT when alert_category::dht_log is set in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>
mask.</p>
<pre class="literal-block">
struct dht_log_alert final : alert
{
   std::string <strong>message</strong> () const override;
   char const* <strong>log_message</strong> () const;

   enum dht_module_t
   {
      tracker,
      node,
      routing_table,
      rpc_manager,
      traversal,
   };

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_log;
   dht_module_t module;
};
</pre>
<a name="log_message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_log_alert%3A%3A%5Blog_message%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_log_alert%3A%3A%5Blog_message%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="log-message-4">
<h2>log_message()</h2>
<pre class="literal-block">
char const* <strong>log_message</strong> () const;
</pre>
<p>the log message</p>
<a name="dht_module_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+dht_module_t&labels=documentation&body=Documentation+under+heading+%22enum+dht_module_t%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="enum-dht-module-t">
<h2>enum dht_module_t</h2>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<table border="1" class="docutils">
<colgroup>
<col width="43%" />
<col width="20%" />
<col width="37%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">value</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>tracker</td>
<td>0</td>
<td>&nbsp;</td>
</tr>
<tr><td>node</td>
<td>1</td>
<td>&nbsp;</td>
</tr>
<tr><td>routing_table</td>
<td>2</td>
<td>&nbsp;</td>
</tr>
<tr><td>rpc_manager</td>
<td>3</td>
<td>&nbsp;</td>
</tr>
<tr><td>traversal</td>
<td>4</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<a name="module"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_log_alert%3A%3A%5Bmodule%5D&labels=documentation&body=Documentation+under+heading+%22dht_log_alert%3A%3A%5Bmodule%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>module</dt>
<dd>the module, or part, of the DHT that produced this log message.</dd>
</dl>
<a name="dht_pkt_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_pkt_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_pkt_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="dht-pkt-alert">
<h1>dht_pkt_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted every time a DHT message is sent or received. It is
only posted if the <tt class="docutils literal"><span class="pre">alert_category::dht_log</span></tt> <a class="reference external" href="reference-Alerts.html#alert">alert</a> category is
enabled. It contains a verbatim copy of the message.</p>
<pre class="literal-block">
struct dht_pkt_alert final : alert
{
   std::string <strong>message</strong> () const override;
   span&lt;char const&gt; <strong>pkt_buf</strong> () const;

   enum direction_t
   {
      incoming,
      outgoing,
   };

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_log;
   direction_t direction;
   aux::noexcept_movable&lt;udp::endpoint&gt; node;
};
</pre>
<a name="pkt_buf()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_pkt_alert%3A%3A%5Bpkt_buf%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_pkt_alert%3A%3A%5Bpkt_buf%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="pkt-buf">
<h2>pkt_buf()</h2>
<pre class="literal-block">
span&lt;char const&gt; <strong>pkt_buf</strong> () const;
</pre>
<p>returns a pointer to the packet buffer and size of the packet,
respectively. This buffer is only valid for as long as the <a class="reference external" href="reference-Alerts.html#alert">alert</a> itself
is valid, which is owned by libtorrent and reclaimed whenever
<a class="reference external" href="reference-Session.html#pop_alerts()">pop_alerts()</a> is called on the <a class="reference external" href="reference-Session.html#session">session</a>.</p>
<a name="direction_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+direction_t&labels=documentation&body=Documentation+under+heading+%22enum+direction_t%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="enum-direction-t-2">
<h2>enum direction_t</h2>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<table border="1" class="docutils">
<colgroup>
<col width="33%" />
<col width="23%" />
<col width="43%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">value</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>incoming</td>
<td>0</td>
<td>&nbsp;</td>
</tr>
<tr><td>outgoing</td>
<td>1</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<a name="direction"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_pkt_alert%3A%3A%5Bdirection%5D&labels=documentation&body=Documentation+under+heading+%22dht_pkt_alert%3A%3A%5Bdirection%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>direction</dt>
<dd>whether this is an incoming or outgoing packet.</dd>
</dl>
<a name="node"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_pkt_alert%3A%3A%5Bnode%5D&labels=documentation&body=Documentation+under+heading+%22dht_pkt_alert%3A%3A%5Bnode%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>node</dt>
<dd>the DHT node we received this packet from, or sent this packet to
(depending on <tt class="docutils literal">direction</tt>).</dd>
</dl>
<a name="dht_get_peers_reply_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_get_peers_reply_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_get_peers_reply_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="dht-get-peers-reply-alert">
<h1>dht_get_peers_reply_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>Posted when we receive a response to a DHT get_peers request.</p>
<pre class="literal-block">
struct dht_get_peers_reply_alert final : alert
{
   std::string <strong>message</strong> () const override;
   int <strong>num_peers</strong> () const;
   std::vector&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; <strong>peers</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_operation;
   sha1_hash info_hash;
};
</pre>
<a name="dht_direct_response_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_direct_response_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_direct_response_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-direct-response-alert">
<h1>dht_direct_response_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This is posted exactly once for every call to session_handle::dht_direct_request.
If the request failed, <a class="reference external" href="reference-Alerts.html#response()">response()</a> will return a default constructed <a class="reference external" href="reference-Bdecoding.html#bdecode_node">bdecode_node</a>.</p>
<pre class="literal-block">
struct dht_direct_response_alert final : alert
{
   std::string <strong>message</strong> () const override;
   bdecode_node <strong>response</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
   client_data_t userdata;
   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
};
</pre>
<a name="picker_log_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+picker_log_alert&labels=documentation&body=Documentation+under+heading+%22class+picker_log_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="picker-log-alert">
<h1>picker_log_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this is posted when one or more blocks are picked by the piece picker,
assuming the verbose piece picker logging is enabled (see
alert_category::picker_log).</p>
<pre class="literal-block">
struct picker_log_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;
   std::vector&lt;piece_block&gt; <strong>blocks</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::picker_log;
   static constexpr picker_flags_t <strong>partial_ratio</strong>  = 0_bit;
   static constexpr picker_flags_t <strong>prioritize_partials</strong>  = 1_bit;
   static constexpr picker_flags_t <strong>rarest_first_partials</strong>  = 2_bit;
   static constexpr picker_flags_t <strong>rarest_first</strong>  = 3_bit;
   static constexpr picker_flags_t <strong>reverse_rarest_first</strong>  = 4_bit;
   static constexpr picker_flags_t <strong>suggested_pieces</strong>  = 5_bit;
   static constexpr picker_flags_t <strong>prio_sequential_pieces</strong>  = 6_bit;
   static constexpr picker_flags_t <strong>sequential_pieces</strong>  = 7_bit;
   static constexpr picker_flags_t <strong>reverse_pieces</strong>  = 8_bit;
   static constexpr picker_flags_t <strong>time_critical</strong>  = 9_bit;
   static constexpr picker_flags_t <strong>random_pieces</strong>  = 10_bit;
   static constexpr picker_flags_t <strong>prefer_contiguous</strong>  = 11_bit;
   static constexpr picker_flags_t <strong>reverse_sequential</strong>  = 12_bit;
   static constexpr picker_flags_t <strong>backup1</strong>  = 13_bit;
   static constexpr picker_flags_t <strong>backup2</strong>  = 14_bit;
   static constexpr picker_flags_t <strong>end_game</strong>  = 15_bit;
   static constexpr picker_flags_t <strong>extent_affinity</strong>  = 16_bit;
   picker_flags_t const picker_flags;
};
</pre>
<a name="picker_flags"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:picker_log_alert%3A%3A%5Bpicker_flags%5D&labels=documentation&body=Documentation+under+heading+%22picker_log_alert%3A%3A%5Bpicker_flags%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>picker_flags</dt>
<dd>this is a bitmask of which features were enabled for this particular
pick. The bits are defined in the picker_flags_t enum.</dd>
</dl>
<a name="session_error_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_error_alert&labels=documentation&body=Documentation+under+heading+%22class+session_error_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="session-error-alert">
<h1>session_error_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when the <a class="reference external" href="reference-Session.html#session">session</a> encounters a serious error,
potentially fatal</p>
<pre class="literal-block">
struct session_error_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
   error_code const error;
};
</pre>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:session_error_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22session_error_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>The error code, if one is associated with this error</dd>
</dl>
<a name="dht_live_nodes_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_live_nodes_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_live_nodes_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-live-nodes-alert">
<h1>dht_live_nodes_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted in response to a call to session::dht_live_nodes(). It contains the
live nodes from the DHT routing table of one of the DHT nodes running
locally.</p>
<pre class="literal-block">
struct dht_live_nodes_alert final : alert
{
   std::string <strong>message</strong> () const override;
   std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
   int <strong>num_nodes</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht;
   sha1_hash node_id;
};
</pre>
<a name="num_nodes()"></a>
<a name="nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_live_nodes_alert%3A%3A%5Bnum_nodes%28%29+nodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_live_nodes_alert%3A%3A%5Bnum_nodes%28%29+nodes%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="num-nodes-nodes">
<h2>num_nodes() nodes()</h2>
<pre class="literal-block">
std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
int <strong>num_nodes</strong> () const;
</pre>
<p>the number of nodes in the routing table and the actual nodes.</p>
<a name="node_id"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_live_nodes_alert%3A%3A%5Bnode_id%5D&labels=documentation&body=Documentation+under+heading+%22dht_live_nodes_alert%3A%3A%5Bnode_id%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>node_id</dt>
<dd>the local DHT node's node-ID this routing table belongs to</dd>
</dl>
<a name="session_stats_header_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+session_stats_header_alert&labels=documentation&body=Documentation+under+heading+%22class+session_stats_header_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="session-stats-header-alert">
<h1>session_stats_header_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>The session_stats_header <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted the first time
<a class="reference external" href="reference-Session.html#post_session_stats()">post_session_stats()</a> is called</p>
<p>the <tt class="docutils literal">message()</tt> member function returns a string representation of the
header that properly match the stats values string returned in
<tt class="docutils literal"><span class="pre">session_stats_alert::message()</span></tt>.</p>
<p>this specific output is parsed by tools/parse_session_stats.py
if this is changed, that parser should also be changed</p>
<pre class="literal-block">
struct session_stats_header_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = {};
};
</pre>
<a name="dht_sample_infohashes_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+dht_sample_infohashes_alert&labels=documentation&body=Documentation+under+heading+%22class+dht_sample_infohashes_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="dht-sample-infohashes-alert">
<h1>dht_sample_infohashes_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted as a response to a call to session::dht_sample_infohashes() with
the information from the DHT response message.</p>
<pre class="literal-block">
struct dht_sample_infohashes_alert final : alert
{
   std::string <strong>message</strong> () const override;
   int <strong>num_samples</strong> () const;
   std::vector&lt;sha1_hash&gt; <strong>samples</strong> () const;
   int <strong>num_nodes</strong> () const;
   std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::dht_operation;
   sha1_hash node_id;
   aux::noexcept_movable&lt;udp::endpoint&gt; endpoint;
   time_duration const interval;
   int const num_infohashes;
};
</pre>
<a name="num_samples()"></a>
<a name="samples()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnum_samples%28%29+samples%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnum_samples%28%29+samples%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="num-samples-samples">
<h2>num_samples() samples()</h2>
<pre class="literal-block">
int <strong>num_samples</strong> () const;
std::vector&lt;sha1_hash&gt; <strong>samples</strong> () const;
</pre>
<p>returns the number of info-hashes returned by the node, as well as the
actual info-hashes. <tt class="docutils literal">num_samples()</tt> is more efficient than
<tt class="docutils literal"><span class="pre">samples().size()</span></tt>.</p>
<a name="num_nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnum_nodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnum_nodes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="num-nodes">
<h2>num_nodes()</h2>
<pre class="literal-block">
int <strong>num_nodes</strong> () const;
</pre>
<p>The total number of nodes returned by <tt class="docutils literal">nodes()</tt>.</p>
<a name="nodes()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnodes%28%29%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnodes%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="nodes">
<h2>nodes()</h2>
<pre class="literal-block">
std::vector&lt;std::pair&lt;sha1_hash, udp::endpoint&gt;&gt; <strong>nodes</strong> () const;
</pre>
<p>This is the set of more DHT nodes returned by the request.</p>
<p>The information is included so that indexing nodes can perform a key
space traversal with a single RPC per node by adjusting the target
value for each RPC.</p>
<a name="node_id"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnode_id%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnode_id%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>node_id</dt>
<dd>id of the node the request was sent to (and this response was received from)</dd>
</dl>
<a name="endpoint"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bendpoint%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bendpoint%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>endpoint</dt>
<dd>the node the request was sent to (and this response was received from)</dd>
</dl>
<a name="interval"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Binterval%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Binterval%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>interval</dt>
<dd>the interval to wait before making another request to this node</dd>
</dl>
<a name="num_infohashes"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:dht_sample_infohashes_alert%3A%3A%5Bnum_infohashes%5D&labels=documentation&body=Documentation+under+heading+%22dht_sample_infohashes_alert%3A%3A%5Bnum_infohashes%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>num_infohashes</dt>
<dd>This field indicates how many info-hash keys are currently in the node's storage.
If the value is larger than the number of returned samples it indicates that the
indexer may obtain additional samples after waiting out the interval.</dd>
</dl>
<a name="block_uploaded_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+block_uploaded_alert&labels=documentation&body=Documentation+under+heading+%22class+block_uploaded_alert%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="block-uploaded-alert">
<h1>block_uploaded_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when a block intended to be sent to a peer is placed in the
send buffer. Note that if the connection is closed before the send buffer is sent,
the <a class="reference external" href="reference-Alerts.html#alert">alert</a> may be posted without the bytes having been sent to the peer.
It belongs to the <tt class="docutils literal"><span class="pre">alert_category::upload</span></tt> category.</p>
<pre class="literal-block">
struct block_uploaded_alert final : peer_alert
{
   std::string <strong>message</strong> () const override;

   int const block_index;
   piece_index_t const piece_index;
};
</pre>
<a name="alerts_dropped_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+alerts_dropped_alert&labels=documentation&body=Documentation+under+heading+%22class+alerts_dropped_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="alerts-dropped-alert">
<h1>alerts_dropped_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted to indicate to the client that some alerts were
dropped. Dropped meaning that the <a class="reference external" href="reference-Alerts.html#alert">alert</a> failed to be delivered to the
client. The most common cause of such failure is that the internal <a class="reference external" href="reference-Alerts.html#alert">alert</a>
queue grew too big (controlled by alert_queue_size).</p>
<pre class="literal-block">
struct alerts_dropped_alert final : alert
{
   <strong>static_assert</strong> (num_alert_types &lt;= abi_alert_count, &quot;need to increase bitset. This is an ABI break&quot;);
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
   std::bitset&lt;abi_alert_count&gt; dropped_alerts;
};
</pre>
<a name="dropped_alerts"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alerts_dropped_alert%3A%3A%5Bdropped_alerts%5D&labels=documentation&body=Documentation+under+heading+%22alerts_dropped_alert%3A%3A%5Bdropped_alerts%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>dropped_alerts</dt>
<dd>a bitmask indicating which alerts were dropped. Each bit represents the
<a class="reference external" href="reference-Alerts.html#alert">alert</a> type ID, where bit 0 represents whether any <a class="reference external" href="reference-Alerts.html#alert">alert</a> of type 0 has
been dropped, and so on.</dd>
</dl>
<a name="socks5_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+socks5_alert&labels=documentation&body=Documentation+under+heading+%22class+socks5_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="socks5-alert">
<h1>socks5_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted with SOCKS5 related errors, when a SOCKS5 proxy is
configured. It's enabled with the alert_category::error <a class="reference external" href="reference-Alerts.html#alert">alert</a> category.</p>
<pre class="literal-block">
struct socks5_alert final : alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
   error_code error;
   operation_t op;
   aux::noexcept_movable&lt;<a class="reference external" href="tcp::endpoint">tcp::endpoint</a>&gt; ip;
};
</pre>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks5_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22socks5_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error</dd>
</dl>
<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks5_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22socks5_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>op</dt>
<dd>the operation that failed</dd>
</dl>
<a name="ip"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:socks5_alert%3A%3A%5Bip%5D&labels=documentation&body=Documentation+under+heading+%22socks5_alert%3A%3A%5Bip%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>ip</dt>
<dd>the endpoint configured as the proxy</dd>
</dl>
<a name="file_prio_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_prio_alert&labels=documentation&body=Documentation+under+heading+%22class+file_prio_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="file-prio-alert">
<h1>file_prio_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted when a <a class="reference external" href="reference-Torrent_Handle.html#prioritize_files()">prioritize_files()</a> or <a class="reference external" href="reference-Torrent_Handle.html#file_priority()">file_priority()</a> update of the file
priorities complete, which requires a round-trip to the disk thread.</p>
<p>If the disk operation fails this <a class="reference external" href="reference-Alerts.html#alert">alert</a> won't be posted, but a
<a class="reference external" href="reference-Alerts.html#file_error_alert">file_error_alert</a> is posted instead, and the torrent is stopped.</p>
<pre class="literal-block">
struct file_prio_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
   error_code error;
   operation_t op;
};
</pre>
<a name="error"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_prio_alert%3A%3A%5Berror%5D&labels=documentation&body=Documentation+under+heading+%22file_prio_alert%3A%3A%5Berror%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>error</dt>
<dd>the error</dd>
</dl>
<a name="op"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_prio_alert%3A%3A%5Bop%5D&labels=documentation&body=Documentation+under+heading+%22file_prio_alert%3A%3A%5Bop%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>op</dt>
<dd>the operation that failed</dd>
</dl>
<a name="oversized_file_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+oversized_file_alert&labels=documentation&body=Documentation+under+heading+%22class+oversized_file_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="oversized-file-alert">
<h1>oversized_file_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> may be posted when the initial checking of resume data and files
on disk (just existence, not piece hashes) completes. If a file belonging
to the torrent is found on disk, but is larger than the file in the
torrent, that's when this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted.
the client may want to call <a class="reference external" href="reference-Core.html#truncate_files()">truncate_files()</a> in that case, or perhaps
interpret it as a sign that some other file is in the way, that shouldn't
be overwritten.</p>
<pre class="literal-block">
struct oversized_file_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::storage;
};
</pre>
<a name="torrent_conflict_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+torrent_conflict_alert&labels=documentation&body=Documentation+under+heading+%22class+torrent_conflict_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="torrent-conflict-alert">
<h1>torrent_conflict_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>this <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted when two separate torrents (magnet links) resolve to
the same torrent, thus causing the same torrent being added twice. In
that case, both torrents enter an error state with <tt class="docutils literal">duplicate_torrent</tt>
as the error code. This <a class="reference external" href="reference-Alerts.html#alert">alert</a> is posted containing the metadata. For more
information, see <a class="reference external" href="manual-ref.html#bittorrent-v2-torrents">BitTorrent v2 torrents</a>.
The torrent this <a class="reference external" href="reference-Alerts.html#alert">alert</a> originated from was the one that downloaded the</p>
<p>metadata (i.e. the <cite>handle</cite> member from the <a class="reference external" href="reference-Alerts.html#torrent_alert">torrent_alert</a> base class).</p>
<pre class="literal-block">
struct torrent_conflict_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::error;
   torrent_handle conflicting_torrent;
   std::shared_ptr&lt;torrent_info&gt; metadata;
};
</pre>
<a name="conflicting_torrent"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_conflict_alert%3A%3A%5Bconflicting_torrent%5D&labels=documentation&body=Documentation+under+heading+%22torrent_conflict_alert%3A%3A%5Bconflicting_torrent%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>conflicting_torrent</dt>
<dd>the handle to the torrent in conflict. The swarm associated with this
torrent handle did not download the metadata, but the downloaded
metadata collided with this swarm's info-hash.</dd>
</dl>
<a name="metadata"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:torrent_conflict_alert%3A%3A%5Bmetadata%5D&labels=documentation&body=Documentation+under+heading+%22torrent_conflict_alert%3A%3A%5Bmetadata%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>metadata</dt>
<dd>the metadata that was received by one of the torrents in conflict.
One way to resolve the conflict is to remove both failing torrents
and re-add it using this metadata</dd>
</dl>
<a name="peer_info_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+peer_info_alert&labels=documentation&body=Documentation+under+heading+%22class+peer_info_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="peer-info-alert">
<h1>peer_info_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_peer_info()">torrent_handle::post_peer_info()</a> is called</p>
<pre class="literal-block">
struct peer_info_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
   std::vector&lt;lt::peer_info&gt; peer_info;
};
</pre>
<a name="peer_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:peer_info_alert%3A%3A%5Bpeer_info%5D&labels=documentation&body=Documentation+under+heading+%22peer_info_alert%3A%3A%5Bpeer_info%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>peer_info</dt>
<dd>the list of the currently connected peers</dd>
</dl>
<a name="file_progress_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+file_progress_alert&labels=documentation&body=Documentation+under+heading+%22class+file_progress_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="file-progress-alert">
<h1>file_progress_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_file_progress()">torrent_handle::post_file_progress()</a> is called</p>
<pre class="literal-block">
struct file_progress_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::file_progress;
   aux::vector&lt;std::int64_t, file_index_t&gt; files;
};
</pre>
<a name="files"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:file_progress_alert%3A%3A%5Bfiles%5D&labels=documentation&body=Documentation+under+heading+%22file_progress_alert%3A%3A%5Bfiles%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>files</dt>
<dd>the list of the files in the torrent</dd>
</dl>
<a name="piece_info_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_info_alert&labels=documentation&body=Documentation+under+heading+%22class+piece_info_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="piece-info-alert">
<h1>piece_info_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_download_queue()">torrent_handle::post_download_queue()</a> is called</p>
<pre class="literal-block">
struct piece_info_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::piece_progress;
   std::vector&lt;partial_piece_info&gt; piece_info;
   std::vector&lt;block_info&gt; block_data;
};
</pre>
<a name="piece_info"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_info_alert%3A%3A%5Bpiece_info%5D&labels=documentation&body=Documentation+under+heading+%22piece_info_alert%3A%3A%5Bpiece_info%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>piece_info</dt>
<dd>info about pieces being downloaded for the torrent</dd>
</dl>
<a name="block_data"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_info_alert%3A%3A%5Bblock_data%5D&labels=documentation&body=Documentation+under+heading+%22piece_info_alert%3A%3A%5Bblock_data%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>block_data</dt>
<dd>storage for <a class="reference external" href="reference-Torrent_Handle.html#block_info">block_info</a> pointers in <a class="reference external" href="reference-Torrent_Handle.html#partial_piece_info">partial_piece_info</a> objects</dd>
</dl>
<a name="piece_availability_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+piece_availability_alert&labels=documentation&body=Documentation+under+heading+%22class+piece_availability_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="piece-availability-alert">
<h1>piece_availability_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_piece_availability()">torrent_handle::post_piece_availability()</a> is called</p>
<pre class="literal-block">
struct piece_availability_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
   std::vector&lt;int&gt; piece_availability;
};
</pre>
<a name="piece_availability"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:piece_availability_alert%3A%3A%5Bpiece_availability%5D&labels=documentation&body=Documentation+under+heading+%22piece_availability_alert%3A%3A%5Bpiece_availability%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>piece_availability</dt>
<dd>info about pieces being downloaded for the torrent</dd>
</dl>
<a name="tracker_list_alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+tracker_list_alert&labels=documentation&body=Documentation+under+heading+%22class+tracker_list_alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="tracker-list-alert">
<h1>tracker_list_alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<p>posted when <a class="reference external" href="reference-Torrent_Handle.html#post_trackers()">torrent_handle::post_trackers()</a> is called</p>
<pre class="literal-block">
struct tracker_list_alert final : torrent_alert
{
   std::string <strong>message</strong> () const override;

   static constexpr alert_category_t <strong>static_category</strong>  = alert_category::status;
   std::vector&lt;announce_entry&gt; trackers;
};
</pre>
<a name="trackers"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:tracker_list_alert%3A%3A%5Btrackers%5D&labels=documentation&body=Documentation+under+heading+%22tracker_list_alert%3A%3A%5Btrackers%5D%22+could+be+improved">report issue</a>]</span><dl class="docutils">
<dt>trackers</dt>
<dd>list of trackers and their status for the torrent</dd>
</dl>
<a name="alert"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+alert&labels=documentation&body=Documentation+under+heading+%22class+alert%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="alert">
<h1>alert</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
<p>The <tt class="docutils literal">alert</tt> class is the base class that specific messages are derived from.
<a class="reference external" href="reference-Alerts.html#alert">alert</a> types are not copyable, and cannot be constructed by the client. The
pointers returned by libtorrent are short lived (the details are described
under <a class="reference external" href="reference-Session.html#pop_alerts()">session_handle::pop_alerts()</a>)</p>
<pre class="literal-block">
struct alert
{
   time_point <strong>timestamp</strong> () const;
   virtual int <strong>type</strong> () const noexcept = 0;
   virtual char const* <strong>what</strong> () const noexcept = 0;
   virtual std::string <strong>message</strong> () const = 0;
   virtual alert_category_t <strong>category</strong> () const noexcept = 0;

   static constexpr alert_category_t <strong>error_notification</strong>  = 0_bit;
   static constexpr alert_category_t <strong>peer_notification</strong>  = 1_bit;
   static constexpr alert_category_t <strong>port_mapping_notification</strong>  = 2_bit;
   static constexpr alert_category_t <strong>storage_notification</strong>  = 3_bit;
   static constexpr alert_category_t <strong>tracker_notification</strong>  = 4_bit;
   static constexpr alert_category_t <strong>connect_notification</strong>  = 5_bit;
   static constexpr alert_category_t <strong>status_notification</strong>  = 6_bit;
   static constexpr alert_category_t <strong>ip_block_notification</strong>  = 8_bit;
   static constexpr alert_category_t <strong>performance_warning</strong>  = 9_bit;
   static constexpr alert_category_t <strong>dht_notification</strong>  = 10_bit;
   static constexpr alert_category_t <strong>session_log_notification</strong>  = 13_bit;
   static constexpr alert_category_t <strong>torrent_log_notification</strong>  = 14_bit;
   static constexpr alert_category_t <strong>peer_log_notification</strong>  = 15_bit;
   static constexpr alert_category_t <strong>incoming_request_notification</strong>  = 16_bit;
   static constexpr alert_category_t <strong>dht_log_notification</strong>  = 17_bit;
   static constexpr alert_category_t <strong>dht_operation_notification</strong>  = 18_bit;
   static constexpr alert_category_t <strong>port_mapping_log_notification</strong>  = 19_bit;
   static constexpr alert_category_t <strong>picker_log_notification</strong>  = 20_bit;
   static constexpr alert_category_t <strong>file_progress_notification</strong>  = 21_bit;
   static constexpr alert_category_t <strong>piece_progress_notification</strong>  = 22_bit;
   static constexpr alert_category_t <strong>upload_notification</strong>  = 23_bit;
   static constexpr alert_category_t <strong>block_progress_notification</strong>  = 24_bit;
   static constexpr alert_category_t <strong>all_categories</strong>  = alert_category_t::all();
};
</pre>
<a name="timestamp()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Btimestamp%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Btimestamp%28%29%5D%22+could+be+improved">report issue</a>]</span><div class="section" id="timestamp">
<h2>timestamp()</h2>
<pre class="literal-block">
time_point <strong>timestamp</strong> () const;
</pre>
<p>a timestamp is automatically created in the constructor</p>
<a name="type()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Btype%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Btype%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="type">
<h2>type()</h2>
<pre class="literal-block">
virtual int <strong>type</strong> () const noexcept = 0;
</pre>
<p>returns an integer that is unique to this <a class="reference external" href="reference-Alerts.html#alert">alert</a> type. It can be
compared against a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> by querying a static constant called <tt class="docutils literal">alert_type</tt>
in the <a class="reference external" href="reference-Alerts.html#alert">alert</a>. It can be used to determine the run-time type of an alert* in
order to cast to that <a class="reference external" href="reference-Alerts.html#alert">alert</a> type and access specific members.</p>
<p>e.g:</p>
<pre class="code c++ literal-block">
<span class="name">std</span><span class="operator">::</span><span class="name">vector</span><span class="operator">&lt;</span><span class="name">alert</span><span class="operator">*&gt;</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">;</span><span class="whitespace">
</span><span class="name">ses</span><span class="punctuation">.</span><span class="name">pop_alerts</span><span class="punctuation">(</span><span class="operator">&amp;</span><span class="name">alerts</span><span class="punctuation">);</span><span class="whitespace">
</span><span class="keyword">for</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">alert</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">a</span><span class="whitespace"> </span><span class="operator">:</span><span class="whitespace"> </span><span class="name">alerts</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
        </span><span class="keyword">switch</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">a</span><span class="operator">-&gt;</span><span class="name">type</span><span class="punctuation">())</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">

                </span><span class="keyword">case</span><span class="whitespace"> </span><span class="name constant">read_piece_alert</span><span class="operator">::</span><span class="name constant">alert_type</span><span class="punctuation">:</span><span class="whitespace">
                </span><span class="punctuation">{</span><span class="whitespace">
                        </span><span class="keyword">auto</span><span class="operator">*</span><span class="whitespace"> </span><span class="name">p</span><span class="whitespace"> </span><span class="operator">=</span><span class="whitespace"> </span><span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="name">read_piece_alert</span><span class="operator">*&gt;</span><span class="punctuation">(</span><span class="name">a</span><span class="punctuation">);</span><span class="whitespace">
                        </span><span class="keyword">if</span><span class="whitespace"> </span><span class="punctuation">(</span><span class="name">p</span><span class="operator">-&gt;</span><span class="name">ec</span><span class="punctuation">)</span><span class="whitespace"> </span><span class="punctuation">{</span><span class="whitespace">
                                </span><span class="comment single">// read_piece failed
</span><span class="whitespace">                                </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
                        </span><span class="punctuation">}</span><span class="whitespace">
                        </span><span class="comment single">// use p
</span><span class="whitespace">                        </span><span class="keyword">break</span><span class="punctuation">;</span><span class="whitespace">
                </span><span class="punctuation">}</span><span class="whitespace">
                </span><span class="keyword">case</span><span class="whitespace"> </span><span class="name constant">file_renamed_alert</span><span class="operator">::</span><span class="name constant">alert_type</span><span class="punctuation">:</span><span class="whitespace">
                </span><span class="punctuation">{</span><span class="whitespace">
                        </span><span class="comment single">// etc...
</span><span class="whitespace">                </span><span class="punctuation">}</span><span class="whitespace">
        </span><span class="punctuation">}</span><span class="whitespace">
</span><span class="punctuation">}</span>
</pre>
<a name="what()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bwhat%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bwhat%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="what">
<h2>what()</h2>
<pre class="literal-block">
virtual char const* <strong>what</strong> () const noexcept = 0;
</pre>
<p>returns a string literal describing the type of the <a class="reference external" href="reference-Alerts.html#alert">alert</a>. It does
not include any information that might be bundled with the <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</p>
<a name="message()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bmessage%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bmessage%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="message-1">
<h2>message()</h2>
<pre class="literal-block">
virtual std::string <strong>message</strong> () const = 0;
</pre>
<p>generate a string describing the <a class="reference external" href="reference-Alerts.html#alert">alert</a> and the information bundled
with it. This is mainly intended for debug and development use. It is not suitable
to use this for applications that may be localized. Instead, handle each <a class="reference external" href="reference-Alerts.html#alert">alert</a>
type individually and extract and render the information from the <a class="reference external" href="reference-Alerts.html#alert">alert</a> depending
on the locale.</p>
<a name="category()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert%3A%3A%5Bcategory%28%29%5D&labels=documentation&body=Documentation+under+heading+%22alert%3A%3A%5Bcategory%28%29%5D%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="category">
<h2>category()</h2>
<pre class="literal-block">
virtual alert_category_t <strong>category</strong> () const noexcept = 0;
</pre>
<p>returns a bitmask specifying which categories this <a class="reference external" href="reference-Alerts.html#alert">alert</a> belong to.</p>
<a name="alert_cast()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert_cast%28%29&labels=documentation&body=Documentation+under+heading+%22alert_cast%28%29%22+could+be+improved">report issue</a>]</span></div>
</div>
<div class="section" id="alert-cast">
<h1>alert_cast()</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
<pre class="literal-block">
template &lt;typename T&gt; T* <strong>alert_cast</strong> (alert* a);
template &lt;typename T&gt; T const* <strong>alert_cast</strong> (alert const* a);
</pre>
<p>When you get an <a class="reference external" href="reference-Alerts.html#alert">alert</a>, you can use <tt class="docutils literal">alert_cast&lt;&gt;</tt> to attempt to cast the
pointer to a specific <a class="reference external" href="reference-Alerts.html#alert">alert</a> type, in order to query it for more
information.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><tt class="docutils literal">alert_cast&lt;&gt;</tt> can only cast to an exact <a class="reference external" href="reference-Alerts.html#alert">alert</a> type, not a base class</p>
</div>
<a name="operation_name()"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:operation_name%28%29&labels=documentation&body=Documentation+under+heading+%22operation_name%28%29%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="operation-name">
<h1>operation_name()</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/operations.hpp">libtorrent/operations.hpp</a>&quot;</p>
<pre class="literal-block">
char const* <strong>operation_name</strong> (operation_t op);
</pre>
<p>maps an operation id (from <a class="reference external" href="reference-Alerts.html#peer_error_alert">peer_error_alert</a> and <a class="reference external" href="reference-Alerts.html#peer_disconnected_alert">peer_disconnected_alert</a>)
to its name. See <a class="reference external" href="reference-Alerts.html#operation_t">operation_t</a> for the constants</p>
<a name="operation_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+operation_t&labels=documentation&body=Documentation+under+heading+%22enum+operation_t%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="enum-operation-t">
<h1>enum operation_t</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/operations.hpp">libtorrent/operations.hpp</a>&quot;</p>
<table border="1" class="docutils">
<colgroup>
<col width="21%" />
<col width="7%" />
<col width="72%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">value</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>unknown</td>
<td>0</td>
<td>the error was unexpected and it is unknown which operation caused it</td>
</tr>
<tr><td>bittorrent</td>
<td>1</td>
<td>this is used when the bittorrent logic
determines to disconnect</td>
</tr>
<tr><td>iocontrol</td>
<td>2</td>
<td>a call to iocontrol failed</td>
</tr>
<tr><td>getpeername</td>
<td>3</td>
<td>a call to <tt class="docutils literal">getpeername()</tt> failed (querying the remote IP of a
connection)</td>
</tr>
<tr><td>getname</td>
<td>4</td>
<td>a call to getname failed (querying the local IP of a
connection)</td>
</tr>
<tr><td>alloc_recvbuf</td>
<td>5</td>
<td>an attempt to allocate a receive buffer failed</td>
</tr>
<tr><td>alloc_sndbuf</td>
<td>6</td>
<td>an attempt to allocate a send buffer failed</td>
</tr>
<tr><td>file_write</td>
<td>7</td>
<td>writing to a file failed</td>
</tr>
<tr><td>file_read</td>
<td>8</td>
<td>reading from a file failed</td>
</tr>
<tr><td>file</td>
<td>9</td>
<td>a non-read and non-write file operation failed</td>
</tr>
<tr><td>sock_write</td>
<td>10</td>
<td>a socket write operation failed</td>
</tr>
<tr><td>sock_read</td>
<td>11</td>
<td>a socket read operation failed</td>
</tr>
<tr><td>sock_open</td>
<td>12</td>
<td>a call to open(), to create a socket socket failed</td>
</tr>
<tr><td>sock_bind</td>
<td>13</td>
<td>a call to bind() on a socket failed</td>
</tr>
<tr><td>available</td>
<td>14</td>
<td>an attempt to query the number of bytes available to read from a socket
failed</td>
</tr>
<tr><td>encryption</td>
<td>15</td>
<td>a call related to bittorrent protocol encryption failed</td>
</tr>
<tr><td>connect</td>
<td>16</td>
<td>an attempt to connect a socket failed</td>
</tr>
<tr><td>ssl_handshake</td>
<td>17</td>
<td>establishing an SSL connection failed</td>
</tr>
<tr><td>get_interface</td>
<td>18</td>
<td>a connection failed to satisfy the bind interface setting</td>
</tr>
<tr><td>sock_listen</td>
<td>19</td>
<td>a call to listen() on a socket</td>
</tr>
<tr><td>sock_bind_to_device</td>
<td>20</td>
<td>a call to the ioctl to bind a socket to a specific network device or
adapter</td>
</tr>
<tr><td>sock_accept</td>
<td>21</td>
<td>a call to accept() on a socket</td>
</tr>
<tr><td>parse_address</td>
<td>22</td>
<td>convert a string into a valid network address</td>
</tr>
<tr><td>enum_if</td>
<td>23</td>
<td>enumeration network devices or adapters</td>
</tr>
<tr><td>file_stat</td>
<td>24</td>
<td>invoking stat() on a file</td>
</tr>
<tr><td>file_copy</td>
<td>25</td>
<td>copying a file</td>
</tr>
<tr><td>file_fallocate</td>
<td>26</td>
<td>allocating storage for a file</td>
</tr>
<tr><td>file_hard_link</td>
<td>27</td>
<td>creating a hard link</td>
</tr>
<tr><td>file_remove</td>
<td>28</td>
<td>removing a file</td>
</tr>
<tr><td>file_rename</td>
<td>29</td>
<td>renaming a file</td>
</tr>
<tr><td>file_open</td>
<td>30</td>
<td>opening a file</td>
</tr>
<tr><td>mkdir</td>
<td>31</td>
<td>creating a directory</td>
</tr>
<tr><td>check_resume</td>
<td>32</td>
<td>check fast resume data against files on disk</td>
</tr>
<tr><td>exception</td>
<td>33</td>
<td>an unknown exception</td>
</tr>
<tr><td>alloc_cache_piece</td>
<td>34</td>
<td>allocate space for a piece in the cache</td>
</tr>
<tr><td>partfile_move</td>
<td>35</td>
<td>move a part-file</td>
</tr>
<tr><td>partfile_read</td>
<td>36</td>
<td>read from a part file</td>
</tr>
<tr><td>partfile_write</td>
<td>37</td>
<td>write to a part-file</td>
</tr>
<tr><td>hostname_lookup</td>
<td>38</td>
<td>a hostname lookup</td>
</tr>
<tr><td>symlink</td>
<td>39</td>
<td>create or read a symlink</td>
</tr>
<tr><td>handshake</td>
<td>40</td>
<td>handshake with a peer or server</td>
</tr>
<tr><td>sock_option</td>
<td>41</td>
<td>set socket option</td>
</tr>
<tr><td>enum_route</td>
<td>42</td>
<td>enumeration of network routes</td>
</tr>
<tr><td>file_seek</td>
<td>43</td>
<td>moving read/write position in a file, <a class="reference external" href="reference-Alerts.html#hostname_lookup">operation_t::hostname_lookup</a></td>
</tr>
<tr><td>timer</td>
<td>44</td>
<td>an async wait operation on a timer</td>
</tr>
<tr><td>file_mmap</td>
<td>45</td>
<td>call to mmap() (or windows counterpart)</td>
</tr>
<tr><td>file_truncate</td>
<td>46</td>
<td>call to ftruncate() (or SetEndOfFile() on windows)</td>
</tr>
</tbody>
</table>
<a name="int"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:int&labels=documentation&body=Documentation+under+heading+%22int%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="int">
<h1>int</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert_types.hpp">libtorrent/alert_types.hpp</a>&quot;</p>
<a name="int::user_alert_id"></a><dl class="docutils">
<dt>user_alert_id</dt>
<dd>user defined alerts should use IDs greater than this</dd>
</dl>
<a name="int::num_alert_types"></a><dl class="docutils">
<dt>num_alert_types</dt>
<dd>this constant represents &quot;max_alert_index&quot; + 1</dd>
</dl>
<a name="alert_category_t"></a><span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:alert_category_t&labels=documentation&body=Documentation+under+heading+%22alert_category_t%22+could+be+improved">report issue</a>]</span></div>
<div class="section" id="alert-category-t">
<h1>alert_category_t</h1>
<p>Declared in &quot;<a class="reference external" href="include/libtorrent/alert.hpp">libtorrent/alert.hpp</a>&quot;</p>
<a name="alert_category_t::error"></a><dl class="docutils">
<dt>error</dt>
<dd><p class="first">Enables alerts that report an error. This includes:</p>
<ul class="last simple">
<li>tracker errors</li>
<li>tracker warnings</li>
<li>file errors</li>
<li>resume data failures</li>
<li>web seed errors</li>
<li>.torrent files errors</li>
<li>listen socket errors</li>
<li>port mapping errors</li>
</ul>
</dd>
</dl>
<a name="alert_category_t::peer"></a><dl class="docutils">
<dt>peer</dt>
<dd>Enables alerts when peers send invalid requests, get banned or
snubbed.</dd>
</dl>
<a name="alert_category_t::port_mapping"></a><dl class="docutils">
<dt>port_mapping</dt>
<dd>Enables alerts for port mapping events. For NAT-PMP and UPnP.</dd>
</dl>
<a name="alert_category_t::storage"></a><dl class="docutils">
<dt>storage</dt>
<dd>Enables alerts for events related to the storage. File errors and
synchronization events for moving the storage, renaming files etc.</dd>
</dl>
<a name="alert_category_t::tracker"></a><dl class="docutils">
<dt>tracker</dt>
<dd>Enables all tracker events. Includes announcing to trackers,
receiving responses, warnings and errors.</dd>
</dl>
<a name="alert_category_t::connect"></a><dl class="docutils">
<dt>connect</dt>
<dd>Low level alerts for when peers are connected and disconnected.</dd>
</dl>
<a name="alert_category_t::status"></a><dl class="docutils">
<dt>status</dt>
<dd>Enables alerts for when a torrent or the <a class="reference external" href="reference-Session.html#session">session</a> changes state.</dd>
</dl>
<a name="alert_category_t::ip_block"></a><dl class="docutils">
<dt>ip_block</dt>
<dd>Alerts when a peer is blocked by the ip blocker or port blocker.</dd>
</dl>
<a name="alert_category_t::performance_warning"></a><dl class="docutils">
<dt>performance_warning</dt>
<dd>Alerts when some limit is reached that might limit the download
or upload rate.</dd>
</dl>
<a name="alert_category_t::dht"></a><dl class="docutils">
<dt>dht</dt>
<dd>Alerts on events in the DHT node. For incoming searches or
bootstrapping being done etc.</dd>
</dl>
<a name="alert_category_t::stats"></a><dl class="docutils">
<dt>stats</dt>
<dd>If you enable these alerts, you will receive a stats_alert
approximately once every second, for every active torrent.
These alerts contain all statistics <a class="reference external" href="reference-Stats.html#counters">counters</a> for the interval since
the lasts stats <a class="reference external" href="reference-Alerts.html#alert">alert</a>.</dd>
</dl>
<a name="alert_category_t::session_log"></a><dl class="docutils">
<dt>session_log</dt>
<dd>Enables debug logging alerts. These are available unless libtorrent
was built with logging disabled (<tt class="docutils literal">TORRENT_DISABLE_LOGGING</tt>). The
alerts being posted are <a class="reference external" href="reference-Alerts.html#log_alert">log_alert</a> and are <a class="reference external" href="reference-Session.html#session">session</a> wide.</dd>
</dl>
<a name="alert_category_t::torrent_log"></a><dl class="docutils">
<dt>torrent_log</dt>
<dd>Enables debug logging alerts for torrents. These are available
unless libtorrent was built with logging disabled
(<tt class="docutils literal">TORRENT_DISABLE_LOGGING</tt>). The alerts being posted are
<a class="reference external" href="reference-Alerts.html#torrent_log_alert">torrent_log_alert</a> and are torrent wide debug events.</dd>
</dl>
<a name="alert_category_t::peer_log"></a><dl class="docutils">
<dt>peer_log</dt>
<dd>Enables debug logging alerts for peers. These are available unless
libtorrent was built with logging disabled
(<tt class="docutils literal">TORRENT_DISABLE_LOGGING</tt>). The alerts being posted are
<a class="reference external" href="reference-Alerts.html#peer_log_alert">peer_log_alert</a> and low-level peer events and messages.</dd>
</dl>
<a name="alert_category_t::incoming_request"></a><dl class="docutils">
<dt>incoming_request</dt>
<dd>enables the <a class="reference external" href="reference-Alerts.html#incoming_request_alert">incoming_request_alert</a>.</dd>
</dl>
<a name="alert_category_t::dht_log"></a><dl class="docutils">
<dt>dht_log</dt>
<dd>enables <a class="reference external" href="reference-Alerts.html#dht_log_alert">dht_log_alert</a>, debug logging for the DHT</dd>
</dl>
<a name="alert_category_t::dht_operation"></a><dl class="docutils">
<dt>dht_operation</dt>
<dd>enable events from pure dht operations not related to torrents</dd>
</dl>
<a name="alert_category_t::port_mapping_log"></a><dl class="docutils">
<dt>port_mapping_log</dt>
<dd>enables port mapping log events. This log is useful
for debugging the UPnP or NAT-PMP implementation</dd>
</dl>
<a name="alert_category_t::picker_log"></a><dl class="docutils">
<dt>picker_log</dt>
<dd>enables verbose logging from the piece picker.</dd>
</dl>
<a name="alert_category_t::file_progress"></a><dl class="docutils">
<dt>file_progress</dt>
<dd>alerts when files complete downloading</dd>
</dl>
<a name="alert_category_t::piece_progress"></a><dl class="docutils">
<dt>piece_progress</dt>
<dd>alerts when pieces complete downloading or fail hash check</dd>
</dl>
<a name="alert_category_t::upload"></a><dl class="docutils">
<dt>upload</dt>
<dd>alerts when we upload blocks to other peers</dd>
</dl>
<a name="alert_category_t::block_progress"></a><dl class="docutils">
<dt>block_progress</dt>
<dd>alerts on individual blocks being requested, downloading, finished,
rejected, time-out and cancelled. This is likely to post alerts at a
high rate.</dd>
</dl>
<a name="alert_category_t::all"></a><dl class="docutils">
<dt>all</dt>
<dd><p class="first">The full bitmask, representing all available categories.</p>
<p class="last">since the enum is signed, make sure this isn't
interpreted as -1. For instance, boost.python
does that and fails when assigning it to an
unsigned parameter.</p>
</dd>
</dl>
</div>

    </div>
    </div>
    <div id="gradient"></div>
    <div id="filler">
    <div id="footer">
    <div><a href="index.html">home</a></div>
    <div><a href="https://blog.libtorrent.org">blog</a></div>
    <div><a href="utp.html">uTP</a></div>
    <div><a href="https://sourceforge.net/projects/libtorrent/files/libtorrent/">download</a></div>
    <div><a href="reference.html">documentation</a></div>
    <div><a href="dht_store.html">DHT put extension</a></div>
    <div><a href="python_binding.html">python bindings</a></div>
    <div><a href="features-ref.html">features</a></div>
    <div><a href="dht_sec.html">DHT security extension</a></div>
    <div><a href="https://sourceforge.net/p/libtorrent/mailman/libtorrent-discuss/">mailing list archive</a></div>
    <div><a href="contributing.html">contributing</a></div>
    <div><a href="streaming.html">streaming</a></div>
    <div><a href="https://github.com/arvidn/libtorrent/issues">report a bug</a></div>
    <div><a href="building.html">building</a></div>
    <div><a href="bittorrent.pdf">bittorrent slides</a></div>
    </div>
	</div>

</div>
</body>
</html>
